Call the find on the ParentsDomain model instead:
$this->Domain->ParentDomain->find('all', array('conditions' =>
array("ParentDomain.chronicle_id"=>1)));
On Sunday, June 10, 2012 11:45:48 PM UTC-4, Michael wrote:
>
> So I have a table called Domains which has a parent_id allowing the
> domains to contain a parent/child relationship, the parent being referred
> to as ParentDomain.
>
> For the case I am working on, the ParentDomain has a variable called
> chronicle_id. The condition I want to make will get all domains where its
> ParentDomain.chronicle_id == 1.
>
> I tried to put array("ParentDomain.chronicle_id"=>1) as a condition to my
> domain find, but id complained because the ParentDomain.chronicle_id was an
> unknown column.
>
> Is it possible to do this in one command, or will I need to make several
> hits to the database to make it work?
>
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php