Skip to content

Commit

Permalink
Optimize INSERT query to avoid an extra UPDATE
Browse files Browse the repository at this point in the history
BaseEntityPersister can save an extra UPDATE query when it
persists a self-referencing entity using an application
generated identifier

Fixes doctrine#7877
  • Loading branch information
sylfabre committed Nov 1, 2019
1 parent e9e012a commit fa08774
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,7 @@ protected function prepareUpdateData($entity)
// The associated entity $newVal is not yet persisted, so we must
// set $newVal = null, in order to insert a null value and schedule an
// extra update on the UnitOfWork.

$uow->scheduleExtraUpdate($entity, [$field => [null, $newVal]]);

$newVal = null;
Expand Down

0 comments on commit fa08774

Please sign in to comment.