Bindable Behavior Now In CakePHP Core
It’s not news that Bindable Behavior has saved countless lives in terms of functionality.
As of Changeset 6918 this has now been integrated into the CakePHP core. So, we’ll have something to look forward to in the official release of CakePHP 1.2. Mind you, there may be a lot of other hidden gems in there, I just haven’t been paying attention lately :).
Most of the functionality is as we remember, with a few exceptions:
-
$this->Article->restrict(‘Comment’) now becomes
$this->Article->contain(‘Comment’)
-
$this->Article->find(‘all’, array(‘restrict’ => array(‘User’))); turns into
$this->Article->find(‘all’, array(‘contain’ => array(‘User’)));
For a complete list of the differences and changes you can check out the
Containable Test Cases for excellent examples of how to use this to it’s full potential.