开发者

find all albums by ids + find all non-private how to?

I search for all albums by id using:

$this->Album->find('all', array(
    'conditions'开发者_StackOverflow社区 => array(
        'Album.id' => $albums_ids,
        'Album.galleries_id' => $id
    )
));

But I also would like to find all non-private albums (private == 0) as well. I tried:

$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)
        )
    )
));

but no success...


it should be gallery_id

$this->Album->find('all', array(
'conditions' => array(
    'Album.galleries_id' => $id,
    'OR'=> array(
        'Album.private' => 0,
        'Album.id' => $albums_ids
    )
)

));


Would you not simply be looking for the following logic instead?

$this->Album->find('all', array(
    'conditions' => array(
        'Album.id' => $albums_ids,
        'Album.galleries_id' => $id,
        'Album.private' => 0,
    )
));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜