Hey guys,  I was hoping someone could help me out with this:

I have 3 tables with the following fields.

   audiences
         id
         audience_name
   stories
         id
         headline
   audiences_stories
        story_id
        audience_id

my story model contains:

   var $name = 'Story';
   $hasAndBelongsToMany =
         array(
              'Audience' =>
              array('className' => 'Audience',
                'joinTable' => 'audiences_stories',
                'foreignKey' => 'story_id',
                'associationForeignKey' => 'audience_id',
                'conditions' => '',
                'fields' => '',
                'order' => '',
                'limit' => '',
                'offset' => '',
                'uniq' => '',
                'finderQuery' => '',
                'deleteQuery' => '',
                'insertQuery' => ''
                       )
                );


My audience Model contains:

var $name = 'Audience';
var $displayField = 'audience_name';

This works great if I don't need to base my query on anything in the 
audience such as only select stories that have a particular audience 
associated with it.

How would I go about returning only stories that have a particular 
audience.  That is where there is a match in the audiences_stories 
table?

Any help is most appreciated.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to