Is it possible, when saving a Zend_Db_Table_Row
, to make ZF apply a SQL function on one column?
For example, if $row->save()
generates by default this SQL query:
UPDATE table SET field = ? WHERE id = ?;
I would like it to automatically apply the GeomFromText()
function on this field:
UPDATE table SET field = GeomFromText(?) WHERE id = ?;
Thanks for any hint on how to do this with Zend_Db
!
Define a custom update
method in your class that inherits from Zend_Db_Table
(not from the Zend_Db_Table_Row
) and use a Zend_Db_Expr
to set the column to the function return value.
See the docs here: http://framework.zend.com/manual/en/zend.db.table.html#zend.db.table.extending.insert-update.