How about using "WITH" in the Judge-Model? Is this a good way to do
it?

class Judges extends AppModel
{
var $name = "Judge";
var $hasAndBelongsToMany = array("MediaSegments" => array("with" =>
"JudgesMediaSegments"));
}




On 15 Apr., 02:37, Bryan Paddock <bryanpadd...@gmail.com> wrote:
> Ah! Thank you!
>
> After a while of tinkering with your code I realised I had the $actsAs in
> the controller and not the model :(
>
> Works like a charm. I've modified all of my code now to use containable
> behaviour. Gone with recursive = -1.
>
> On Wed, Apr 14, 2010 at 3:45 PM, Jeremy Burns <jeremybu...@me.com> wrote:
>
> Are you using Containable behaviour? You should be!
>
>
>
> > Try this...(typed without testing - so go easy on me if it's wrong!)...
>
> > From the MediaSegment controller:
>
> > $this->MediaSegment->find(
> >  'all',
> > array(
> > 'contain' => array(
> > 'Judge'
> >  ),
> > 'conditions' =>array(
> > 'MediaSegment.id' => $id
> >  )
> > )
> > );
>
> > From the judges controller:
>
> > $this->Judge->MediaSegment->find(
> >  'all',
> > array(
> > 'contain' => array(
> > 'Judge'
> >  ),
> > 'conditions' =>array(
> > 'MediaSegment.id' => $id
> >  )
> > )
> > );
>
> > From within a model, just omit the first Model in the find statement (so
> > $this->find())
>
> >  Jeremy Burns
> > jeremybu...@me.com <jeremybu...@mac.com>
>
> > On 14 Apr 2010, at 14:37, Bryan Paddock wrote:
>
> > Hey all,
>
> > Going a bit crazy here I think I need a break from this. Anyways,
>
> > I have the following tables + relationships
>
> > Judges
> > MediaSegments (a category that the judge is selected to judge)
> > JudgesMediaSegments (contains judge_id and media_segment_id)
>
> > How would I find all the judges that belong to a specific media segment?
>
> > I know its something really simple I just cannot seem to get it right.
>
> > Thanks
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group
> > athttp://groups.google.com/group/cake-php?hl=en
>
> >  Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com<cake-php%2bunsubscr...@googlegroups.com>For
> >  more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en

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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com 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