开发者

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

开发者 https://www.devze.com 2023-03-26 23:22 出处:网络
I search for all albums by id using: $this->Album->find(\'all\', array( \'conditions\'开发者_StackOverflow社区 => array(

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

精彩评论

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

关注公众号