Doctrine 1.2 doesn’t provide a way to do “on duplicate key update” query unless you do raw sql. However, they do provide a “replace” method that will get the job done. Your table will need a unique key or unique index on multiple columns for this to work, just like on duplicate key update. The different is that replace will delete the existing record and then insert a new one if the key is already found, so this might cause trouble if the table has an auto increment key.
Here is an example on how to use doctrine’s replace method
$obj = new Obj(); $obj->content_uuid = $content_uuid; $obj->file_id = $fileId; $obj->sort_order = $sortOrder; $obj->replace();