[CakePHP] hasMany + conditions
hasManyのconditionsを動的に変更する例です。
麻生太郎さんの有益な発言を取得する場合。
麻生太郎さんの有益な発言を取得する場合。
$options=array();
$options['conditions']['User.name']='麻生太郎';
$this->User->hasMany['Comment']['conditions']='Comment.status=1';
$this->User->find('all',$options);