I am very new to CakePHP and I was just wondering if someone could help me with a couple of things. I have a User class and an Image class.
In my users_controller.php I have the following functions
function beforeFilter(){
$this->userOb = $this->User->find();
}
function beforeRender(){
$this->set('userOb', $this->userOb);
}
This works fine and I can view the object in my view, with all the correct relations to the Image class.
But doing this overwrites the beforeFilter() and beforeRender() functions in my app_controller.php, so I try and move this functionality to my app_controller.php but I get an error (Undefined property: PagesController::$User)
Also,
$this->Auth->user();
doesn't seem to have the full object map that
$this->User->find();
returns.
So, I guess my question is how can I create a variable that is acessable in all my views, i.e it's defined in app_controller.php, that contains the current logged in Users Object and it's relations.
Thanks.