Call model not work - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Model-View-Controller (https://forum.codeigniter.com/forumdisplay.php?fid=10) +--- Thread: Call model not work (/showthread.php?tid=67024) |
Call model not work - Wilmer - 01-03-2017 Hi, I find myself trying codeigniter 3, but I have a very rare problem. I have the following classes: PHP Code: class Recursos extends CI_Controller { and my model is: PHP Code: class Recursos_model extends CI_Model{ PHP Code: class Permisos_model extends CI_Model{ With Recuros_model does not work, however, with Permisos_model if it does. What do you think the problem is? RE: Call model not work - albertleao - 01-03-2017 What doesn't work? Do you get an error? RE: Call model not work - Wilmer - 01-03-2017 (01-03-2017, 11:17 AM)albertleao Wrote: What doesn't work? Do you get an error? This error is: A PHP Error was encountered Severity: Notice Message: Undefined property: Recursos::$recursos_model Filename: controllers/Recursos.php Line Number: 12 Backtrace: File: C:\xampp\htdocs\invent\application\controllers\Recursos.php Line: 12 Function: _error_handler File: C:\xampp\htdocs\invent\index.php Line: 315 Function: require_once RE: Call model not work - Wilmer - 01-03-2017 I use acl for restriction over hook: class ACL { private $perms; private $role_field; private $CI; public function __construct() { $this->CI =&get_instance(); if (!isset($this->CI->session)) { # Sessions are not loaded $this->CI->load->library('session'); } if (!isset($this->CI->router)) { # Router is not loaded $this->CI->load->library('router'); } if (!isset($this->CI->url)) { # Router is not loaded $this->CI->load->helper('url'); } $this->CI->load->model('permisos_model'); //$this->CI->load->model('recursos_model'); <- work if enable here if($this->CI->session->userdata('rolID')){ $this->role_field = $this->CI->session->userdata('rolID'); } else $this->role_field = 0; $hola = $this->CI->permisos_model->getAllow(); foreach ($hola->result_array() as $key => $value) { $this->perms[$value['rolID']][$value['controller']][$value['metod']] = ($value['status'] == 1) ? TRUE : FALSE; } } But it is no longer necessary to state in the controller constructor, what problems or what would help or hurt this situation? RE: Call model not work - albertleao - 01-04-2017 What is the filename of the models? RE: Call model not work - Wilmer - 01-05-2017 The filename is: Permisos_model.php Recursos_model.php RE: Call model not work - ProfessionalCoder - 02-21-2017 change this code $sql = "select * from tab_recursos where idparent =".$parent; RE: Call model not work - ignitedcms - 02-23-2017 Why do people still use native sql in their queries when we have the query builder class? The only time it is necessary is if you're doing a complex join or something. |