mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
$em->flush($entity) flushes all entities scheduled for insert #5812
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jskarpe on GitHub (Dec 20, 2017).
Originally assigned to: @Ocramius on GitHub.
doctrine/orm: v2.5.12
I have an entity without any relations set that I pass to flush().
Expected result
INSERT of only this entity
Actual result
All entities scheduled for inserts are put into the database
Looking at the code, computing changesets for all insert changesets in
computeSingleEntityChangeSetseems strange to me:UnitOfWork.php ->
function computeSingleEntityChangeSetcontains the following:With computeScheduleInsertsChangeSets:
@Ocramius commented on GitHub (Dec 20, 2017):
This is normal:
EntityManager#flush($entity)is deprecated, as it was initially only thought for performance optimisations, but does indeed perform any DB operations that were already scheduled.Please don't use it, and just use
EntityManager#flush()instead.