开发者

Do I need to wrap strings with '' when using Doctrine update set method?

I am using Doctrine Update query as follow.

$oQuery = Doctrine_Query::create() ->u开发者_如何学Cpdate("Model") ->set("field",$value);

the problem is that if $value is string, I have to ->set("field","'".$value."'");

if it normal? Why can't doctrine do it itself?

am I missing something?


Yes, use proper Doctrine syntax:

...
->update('Model m')
->set('m.field', '?', $value)
...

This old document will tell you all about it:

http://www.symfony-project.org/doctrine/1_2/en/06-Working-With-Data

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜