开发者

The WHERE IN clause using propel in symfony

开发者 https://www.devze.com 2023-01-07 15:03 出处:网络
How can I create the following query using propel ? UPDATE tablename SET status = 1 WHE开发者_Python百科RE id IN (1,2,3,4)

How can I create the following query using propel ?

UPDATE tablename SET status = 1 WHE开发者_Python百科RE id IN (1,2,3,4)


$con = Propel::getConnection();

$selectCriteria = new Criteria();
$selectCriteria->add(TablenamePeer::ID, array(1,2,3,4), Criteria::IN);

$updateCriteria = new Criteria();
$updateCriteria->add(TablenamePeer::STATUS, 1);

BasePeer::doUpdate($selectCriteria, $updateCriteria, $con);


Try:

$criteria = new Criteria();
$criteria->add(ClassPeer::ID, array(1,2,3,4), Criteria::IN);

(I haven't used IN, so I'm only guessing that the 'value' argument should be an array). Criteria API documentation is at 1.

0

精彩评论

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