Hi,
I have two models: Member and Department which HABTM each other.
I'm doing the following find:
$this->Member->Department-
>find('all',array('conditions'=>array('Department.name LIKE'=>'%'.
$somesearchvalue.'%')));
This gives me a resulting array where each position has the Department
data plus an array of Members in that
Department (if any).
What I need to do is extract the member ids in that resulting array,
so I do a foreach this way:
$member_ids = array();
foreach($departments as $department) { foreach($department['Member']
as $member) { $member_ids[] = $member['id']; } }
What I would like to avoid is the foreach loop, because a search could
bring lots and lots of departments.
Is there a trick, function, or more efficient way to achieve this?
Thanks in advance
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