Hello.
My Problem: Linked to my Employees
table I've got an Address
table containing a virtual field called full_name
(I guess you can imagine by yourself what it does). I added the Containable Behaviour and this function
function beforeFind() {
$this->contain('Address.full_name');
}
to my Employees model, so that I don't have to call $this->contain(..)
in every single controller action (I need the full_name
field in pretty every action). BUT id doesn't work then if the controller action does just a $this->Employee->find('all')
(or read(..)
. Contrary, it works if
- The controller action uses
$this->paginate();
instead $this->Employee->contain('Address.full_name');
gets called before the$this->Employee->find('all');
call. I can't imagine the cause for this because after this explicitcontain(..)
call,contain(..)
gets called again by the Model callback functionbeforeFind()
, as adebug
proofed which I inserted into the cake/libs/models/behaviours/containable.php:contain() function *cough*.
I don't know what to do now, anyone else knows?