In my article search three models are involved:
Article -> belongsTo Author
Author -> hasMany Articles
Author -> hasOne User
User -> belongsTo Author
the User model separates web account data from the personal author
information, it holds login/password, as well as a flag telling if a
User is active ('Y').
I'd like to retrieve all Articles matching certain criteria
like $conditions['Article']['topic'] = "blabla"; and so on, this works
fine.
But i'm not able to restrict the results to *only active* Users<-
Authors.
this is the code i tried in the article search action
$bindArray = array();
$bindArray['belongsTo']['somestring'] = array('className'=>'User');
$this->Article->bindModel($bindArray);
$conditions['somestring.active'] = "= 'Y'";
(ERROR: Unknown column 'Article.user_id' in 'on clause')
Also $this->Article->Author->bindModel($bindArray); doesn't work
(ERROR: Unknown column 'somestring.active' in 'where clause')
this is the find statement
$this->Article->recursive = 1;
$sortby = array("Article.created" => "DESC");
$article_list = $this->Article->findAll($conditions, null, $sortby);
I know i can get this running, but i'm stuck here.
Do i have to bind the User model at all ? (since it *is* already
associated->associated
via Author...)
thanks a lot,
jyrgen
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---