我使用以下网址id
搜索所有相册:
$this->Album->find('all', array(
'conditions' => array(
'Album.id' => $albums_ids,
'Album.galleries_id' => $id
)
));
但我也希望找到所有非私人相册(private == 0
)以及。我试过了:
$this->Album->find('all', array(
'conditions' => array(
'Album.id' => $albums_ids,
'Album.galleries_id' => $id,
'OR'=> array(
array('Album.private' => 0),
array('Album.galleries_id' => $id)
)
)
));
但没有成功......
答案 0 :(得分:1)
它应该是gallery_id
$this->Album->find('all', array( 'conditions' => array( 'Album.galleries_id' => $id, 'OR'=> array( 'Album.private' => 0, 'Album.id' => $albums_ids ) )
));
答案 1 :(得分:0)
您是否只是简单地寻找以下逻辑?
$this->Album->find('all', array(
'conditions' => array(
'Album.id' => $albums_ids,
'Album.galleries_id' => $id,
'Album.private' => 0,
)
));