$contacts = $this->Contact->find('first',
                        array(
                                'conditions' =>
array('Contact.jobType' => 'main)
                                )
                        );


Note the 'first' parameter.

On Aug 22, 12:40 am, eagle <[EMAIL PROTECTED]> wrote:
> Hi,
> First of I'm new to Cake and tryign it out for the first time - I've
> searched here and on Google to solve what I suspect will be an
> idiotically simple question ....
>
> Two tables:
> VENUES hasmany CONTACTS
> all linked in the models correctly
>
> On my default view of the venues table I want to filter the contacts
> to display only one of the potentially many based on a field value of
> 'main'.
>
> venues_controller::index() is
> $this->Venue->recursive = 1;
> $this->set('venues',$this->paginate('Venue'));
> $venues = $this->Venue->find('all');
>
> and contacts_controller::index() is
> $this->Contact->recursive = 1;
> $contacts = $this->Contact->find('all',
>                         array(
>                                 'conditions' => array('Contact.jobType' => 
> 'main)
>                                 )
>                         );
> $this->set('contacts', $contacts);
>
> I can retrieve all contacts for a venue on the index view for venues,
> but I only want the 'main' one.
>
> Should I set up a custom query in the venues_controller to do this? Or
> am I missing somehting more obvious?
>
> Thanks for any guidance.
>
> Eagle
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to