Friday, January 2, 2009

Re: Conditional find on recursive belongsTo association

Probably just a typo, but it should be 'foreignKey' not
'foriegnKey' ...

All you need to do is set the recursive level on your parent model,
and you should get all the related data:

$this->Staff->recursive = 2;

Or set recursive in your find.

On Dec 30 2008, 3:58 am, WebbedIT <p...@webbedit.co.uk> wrote:
> That doesn't work either as I can't the following returns a
> Staff.Person.organisation_id SQL error
>
> $this->Staff->bindModel(array(
>   'belongsTo'=>array(
>     'Organisation'=>array(
>       'foriegnKey'=>'Person.organisation_id'
>     )
>   )
> ));
>
> I then tried to use paginate on $this->Staff->Person as that would
> allow me to access the Organisation table properties, whilst still
> pulling out Staff details, but this seems the wrong way to do it and
> would entail removing a lot of relations I do not require from the
> Person model.
>
> Surely there is a simpler way to paginate data from my Staff model
> filtered by a field in a table two belongsTo associations away?  All I
> need is for Cake to join these three tables together by their
> belongsTo associations.  I've been stuck at this point for over a week
> now and would be hugely grateful to anyone who can help me out.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: