views:

98

answers:

1

I need to set value in mapped record to some arbitrary sql expression, so on obj.save() it would be used directly, 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.

+1  A: 

Turns out its just

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

but not documented anywhere besides source code.

Daniel Kluev