Php 如何正确更新symfony上的整型字段加值?

Php 如何正确更新symfony上的整型字段加值?,php,sql-update,symfony-1.4,Php,Sql Update,Symfony 1.4,我和symfony一起工作了几天,现在我正在尝试更新,但是我遇到了很多问题,其中之一是我找不到一种方法来更新一个字段,添加一个值,而不是替换值,我只想添加一个新的 $q = Doctrine_Query::create() ->update('OhrmBudget') ->set('spent', 'spend' + $cost) ->where('month', $month) ->where('year', $year); $q->execute(); 我觉得

我和symfony一起工作了几天,现在我正在尝试更新,但是我遇到了很多问题,其中之一是我找不到一种方法来更新一个字段,添加一个值,而不是替换值,我只想添加一个新的

$q = Doctrine_Query::create()
->update('OhrmBudget')
->set('spent', 'spend' + $cost)
->where('month', $month)
->where('year', $year);
$q->execute();
我觉得“哪里”不管用!因为我还有另一个更新,它将新值设置为表中的所有字段

$q = Doctrine_Query::create()
->update('OhrmTrainningSubmit')
->set('state', $state)
->where('trainning', $training)
->andWhere('user', $user);
$q->execute();
你知道怎么更新吗?我查了参考资料我查了,但是他们没有一个做过这样的更新,也没有一个在我需要的地方使用超过一个,有人能给我一个主意吗

我支持symfony 1.4


谢谢

我想对于您的第一个查询,最好是:

$q = Doctrine_Query::create()
->update('OhrmBudget b')
->set('b.spent', 'newvalue')
->where('b.month = ?', $month)
->andWhere('b.year = ?', $year)
->execute();
第二个where必须使用“和where()”而不是“where()”