DQL (Doctrine Query Language) - UPDATE queries.php 379 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
<?php
$q    = 'UPDATE Account SET amount = amount + 200 WHERE id > 200';

$rows = $this->conn->query($q);

// the same query using the query interface

$q = new Doctrine_Query();

$rows = $q->update('Account')
          ->set('amount', 'amount + 200')
          ->where('id > 200')
          ->execute();
          
print $rows; // the number of affected rows
?>