开发者

Doctrine: Set field value to SQL expression

I need to set value in mapped record to some arbitrary sql expression, so on obj.save() it would be used directly开发者_StackOverflow社区, w/out escaping/quoting.

Something like this:

obj.location = "Point($x, $y)";
obj.save(); 

Which should result in query like UPDATE ... SET location = Point(..., ...) WHERE ...;

However I cannot find anything like this in the docs, except DQL ->update()->set(). I'd prefer to not use DQL, since it is used in both insert and update contexts.


Turns out its just

obj.location = new Doctrine_Expression("Point(10, 10)");

but not documented anywhere besides source code.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜