I hear your pain! On occasions like this where I want to create a
binding that's only used sometimes, I put it in my model, and call it
from the controller. You can then use extra parameters to specifying
any custom things about the binding. That way, at least you keep all
your binding methods in your model and it should be easier to track
and change if you need to.

class Movie extends AppModel {

function bindGenre($something)
{
    $this->bindModel(...);
}

}

Cheers,
Adam

On Jun 20, 8:04 pm, daxhuiberts <[EMAIL PROTECTED]> wrote:
> I figured it out:
>
> $this->Genre->bindModel(array('hasAndBelongsToMany' => array('Movies'
> => array('className' => 'Movie', 'joinTable' => 'movies_genres',
> 'limit'=> '20, 20'))));
> $genre = $this->Genre->find("name = 'comedy'");
>
> But this doesn't really make me happy.
> Now each and every time I want a subset of movies in a certain genre I
> have to rewrite by association all over again.
> Not to mention I also use 2 HABTM on the Person model ('actors' and
> 'directors'), a HABTM on Country, one on Language and probably a
> couple more to come.
> I'm from a ROR background, and I can't really call this very DRY
> (don't repeat yourself).
> What if I halfway through change the name of my join_table or even a
> model. I have to make the changes in lots of different places. I'm not
> waiting for that to happen.
>
> So is there really no other way to make it much more simpler?
>
> Dax


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