On Apr 12, 2:51 am, paws_galuten <[email protected]> wrote:
> > One thing you could do is *not* contain Area and, instead, run a
> > find() on that separately. In your view, when listing the shifts, get
> > the Area.name from the Shift.area_id. Something like:
>
> > $this->set('data', $this->Person->find(..., 'contain' =>
> > array('Shift') ...
>
> > $this->set('areas', $this->Person->Shift->Area->find('list'));
>
> hmm... but then I would get all of the areas, and what I want is just
> the areas that are associated with the shifts from that person.

Of course.How else do you expect to be able to show that Shift X is at
Area Y? If you're running through a foreach loop to list the Shifts,
either the Area must be somewhere in the current array iteration or
you have to use the current Shift.area_id to look up the Area.name
from a general array of Areas.

Try writing out the array you would like to get from your find() and I
think you'll quickly see that it's unworkable.

> If there were 50 areas, it would be better to list 10 of them twice
> each than to list all 50 only once... know what i mean?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe, reply using "remove me" as the subject.

Reply via email to