Welcome Guest, Not a member yet? Register   Sign In
Undefined model
#1

[eluser]Martenvanurk[/eluser]
Dear,

I'm using the following code:

Code:
$this -> load -> model ( 'AclModel' );

$this -> load -> model ('MenuModel');
$this -> MenuModel -> setAcl ( $this -> AclModel );

This is my model:
Code:
class MenuModel extends CI_Model {
    /**
     * Acces control list object
     * @var object
     */
    private $acl;

    public function setAcl( &$acl )
    {
        $this->acl = $acl;
    }
}

When I create an error in the model, CI report it fine. So the model is loaded normal.
But when I use the code in the first block in my controller I got the following error:

Quote:A PHP Error was encountered

Severity: Notice

Message: Undefined property: Menu::$MenuModel

Filename: controllers/Menu.php

Line Number: 36

Line 36 is this line ( first code block): $this -> MenuModel -> setAcl ( $this -> AclModel );

In the code before this, I loaded the MenuModel without any problems. Will this cause the error? Think CI will use the Singleton or Dependency Injection container though.

How can I fix this error, the syntax is right I think.....

Kind regards!
Marten


Messages In This Thread
Undefined model - by El Forum - 03-22-2012, 07:27 AM
Undefined model - by El Forum - 03-22-2012, 08:33 AM
Undefined model - by El Forum - 03-22-2012, 08:36 AM
Undefined model - by El Forum - 03-22-2012, 08:41 AM
Undefined model - by El Forum - 03-22-2012, 08:43 AM
Undefined model - by El Forum - 03-22-2012, 08:46 AM
Undefined model - by El Forum - 03-22-2012, 08:53 AM



Theme © iAndrew 2016 - Forum software by © MyBB