I have the following model structure set up:
Model1 -hasOne- Model2 -hasAndBelongsToMany- Model3
I'm trying to run a paginate() call on Model1 (in Model1's controller)
while trying to pass custom conditions having to do with Model3. For
example:
$results = $this->paginate('Model1', array('conditions' =>
array('Model3.title' => 'LIKE %blah%')));
Of course it complains that Model3.title doesn't exist because the
query's not doing any join between Model2 and Model3. I've read all
the posts and articles about binding dummy hasOne associations before
doing my paginate call.
OK, so I decided to put the dummy bindModel() in the beforeFind()
function in Model2. Then I did my paginate() call on Model2, but of
course now I'm querying the wrong data because I really need
paginate() support for Model1. Arg.
Has anyone had any success solving this problem? I've seen lots of
solutions for filtering between two models that have a HABTM
relationship and the dummy bindModel() calls seem to work for that,
but this problem seems to be a different animal. Any ideas?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---