On Apr 12, 1:35 am, paws_galuten <[email protected]> wrote:
> I am using containables for it already. The point for me is that if
> two shifts come from the same area, that same area info will be listed
> for each shift. Somehow I'd like to get that area info only once...

But then how would you expect a particular Shift to be associated with
an Area? In the data array, I mean. You would have an array of Shifts
and ... where would the Areas come?

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'));

view:

foreach($data['Shift'] as $shift)
{
...
Area: <?= $areas[$shift['area_id']] ?>

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