Jyrgen, maybe if it's written like this it will answer your question:
$TagIdList = array(1,2,3); // can be any length
foreach ($TagIdList as $tagId) {
$bindArray = array();
$Alias = rand();//'PostsTag'.$tagId; // could be any (unique)string
$bindArray['hasOne'][$Alias]
= array('className'=>'PostsTag');
$this->Post->bindModel($bindArray);
$constraint[$Alias.'.tag_id'] = $tagId;
}
$constraint['Post.published'] = '< '.date('Y-m-d H:i:s');
// Find all posts publish and linked to all of tags in the tagIdList
$this->Post->findAll($constraint);
The ONLY 'extra' model definition required to use jon's code, this, or
the code from the original thread is the one for the join table.
HTH,
AD
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---