17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 948 Views |
-
Reference to relation entity from controller

21 November 2008 at 11:14pm Last edited: 21 November 2008 11:15pm
Hi,
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.
Thanks.Regards Trym
-
Re: Reference to relation entity from controller

23 November 2008 at 8:42am
Hi Trym,
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.
-
Re: Reference to relation entity from controller

24 November 2008 at 8:36pm Last edited: 24 November 2008 8:37pm
Hi
Thanks ajshort.
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)?Thanks.
Regards Trym
| 948 Views | ||
|
Page:
1
|
Go to Top |


