17487 Posts in 4473 Topics by 1978 members
|Go to End|
21 November 2008 at 11:14pm Last edited: 21 November 2008 11:15pm
I have at Page class with a
static $many_many = array('Teasers' => 'TeaserPage');
and would like to get a reference to the related Teasers from a function in the controller class (Page_Controller).
Any suggestions are welcome.
23 November 2008 at 8:42am
You can just do $this->Teasers() - as this will fall over to the data model your controller is attached to. The general rule is that you access DB fields like instance properties, and relationships like methods.
24 November 2008 at 8:36pm Last edited: 24 November 2008 8:37pm
What should I do if I needed only a few of the entities before extracting them from the database (e.g. sql: WHERE teasers.colour = 'blue')?
And any hints where I can read about this (code, wiki, documentation)?
|Go to Top|