Thanks Richard, I had tried that already, and it works fine when
viewing contacts but not for retrieving just the 'main' contact when
viewing the venues. The venue page is not reading the conditions set
in the contacts_controller. It is basically a SELECT * FROM contacts
not a SELECT * FROM CONTACTS WHERE jobType = 'main' which is what I
thought I was setting.
Thanks
On Aug 22, 9:23 am, RichardAtHome <[EMAIL PROTECTED]> wrote:
> $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 [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
-~----------~----~----~----~------~----~------~--~---