implementing “update if exists” in Doctrine ORM

后端 未结 4 2007
野趣味
野趣味 2020-12-10 01:46

I am trying to INSERT OR UPDATE IF EXISTS in one transaction.

in mysql, I would generally use DUPLICATE KEY (\"UPDATE ON

4条回答
  •  情深已故
    2020-12-10 01:52

    Doctrine supports REPLACE INTO using the replace() method. This should work exactly like the ON DUPLICATE KEY UPDATE you were looking for.

    Docs: Replacing Records

提交回复
热议问题