1
0
mirror of synced 2025-02-02 21:41:45 +03:00

#5849 #5850 minor performance optimization - avoiding get_class() calls on all entity insertions

This commit is contained in:
Marco Pivetta 2016-06-06 00:25:48 +02:00
parent b9b952ce8a
commit 68c5d761a8

View File

@ -3477,7 +3477,8 @@ class UnitOfWork implements PropertyChangedListener
private function clearEntityInsertionsForEntityName($entityName)
{
foreach ($this->entityInsertions as $hash => $entity) {
if (get_class($entity) === $entityName) {
// note: performance optimization - `instanceof` is much faster than a function call
if ($entity instanceof $entityName && get_class($entity) === $entityName) {
unset($this->entityInsertions[$hash]);
}
}