Phalcon ORM 批量更新

Phalcon ORM Batch Update

简单的问题,如果你是 Phalcon 用户..你知道我想做什么。

$trueFind = ProductOrderTransaction::find(["conditions"=>"protPthdId = ".$id]);
$trueFind->setTransaction($transaction); 
$trueFind->protMomsId = $monitId;
$trueFind->protMomsName = $monitName;
if (!$trueFind->update()) {
    foreach ($trueFind->getMessages() as $message) {
        $this->flash->error($message);
        $transaction->rollback($message->getMessage());
    }
}

我只想在 orm Phalcon 中执行此查询:

UPDATE product_order_transaction set protMomsId = '$monitId' , protMomsName = '$monitName' WHERE protPthdId='$id'

失败 -> 回滚.. 成功 -> 提交。

是这样的吗?

$items = ProductOrderTransaction::find([
    'conditions' => 'protPthdId = :id:',
    'bind' => ['id' => $id]
]);

foreach($items as $item){
    $this->db->begin();

    $item->protMomsId = $monitId;
    $item->protMomsName = $monitName;
    $update = $item->update();

    if(!$update){
        $this->db->rollback();
        continue;
    }
    $this->db->commit();
}