CakePHP访问完整的用户信息

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.

If the issue is your parent methods are being overwritten by child methods, simply call the parent method in the child, see below:

function beforeFilter(){
    parent::beforeFilter();
    $this->userOb = $this->User->find();
}
function beforeRender(){
    parent::beforeRender();
    $this->set('userOb', $this->userOb);
}

put your find result in SessionComponent so you don't have to perform a query for each request (and set variable in beforeRender). In the view you can access it with SessionHelper. $this->Auth->user(); only have the User record.