Code Duplication    Length = 3-5 lines in 7 locations

lib/Doctrine/ODM/MongoDB/UnitOfWork.php 6 locations

@@ 653-655 (lines=3) @@
650
        }
651
652
        // Fire PreFlush lifecycle callbacks
653
        if ( ! empty($class->lifecycleCallbacks[Events::preFlush])) {
654
            $class->invokeLifecycleCallbacks(Events::preFlush, $document, array(new Event\PreFlushEventArgs($this->dm)));
655
        }
656
657
        $this->computeOrRecomputeChangeSet($class, $document);
658
    }
@@ 1039-1041 (lines=3) @@
1036
    private function persistNew(ClassMetadata $class, $document)
1037
    {
1038
        $oid = spl_object_hash($document);
1039
        if ( ! empty($class->lifecycleCallbacks[Events::prePersist])) {
1040
            $class->invokeLifecycleCallbacks(Events::prePersist, $document, array(new LifecycleEventArgs($document, $this->dm)));
1041
        }
1042
        if ($this->evm->hasListeners(Events::prePersist)) {
1043
            $this->evm->dispatchEvent(Events::prePersist, new LifecycleEventArgs($document, $this->dm));
1044
        }
@@ 1119-1121 (lines=3) @@
1116
                    $embeddedClass = $this->dm->getClassMetadata(get_class($embeddedDocument));
1117
                }
1118
1119
                if ( ! empty($embeddedClass->lifecycleCallbacks[Events::postPersist])) {
1120
                    $embeddedClass->invokeLifecycleCallbacks(Events::postPersist, $embeddedDocument, array(new LifecycleEventArgs($document, $this->dm)));
1121
                }
1122
                if ($hasPostPersistListeners) {
1123
                    $this->evm->dispatchEvent(Events::postPersist, new LifecycleEventArgs($embeddedDocument, $this->dm));
1124
                }
@@ 1334-1338 (lines=5) @@
1331
                }
1332
1333
                if (isset($this->documentInsertions[$entryOid])) {
1334
                    if ( ! empty($entryClass->lifecycleCallbacks[Events::postPersist])) {
1335
                        $entryClass->invokeLifecycleCallbacks(Events::postPersist, $entry, array(
1336
                            new LifecycleEventArgs($entry, $this->dm)
1337
                        ));
1338
                    }
1339
                    if ($hasPostPersistListeners) {
1340
                        $this->evm->dispatchEvent(Events::postPersist, new LifecycleEventArgs($entry, $this->dm));
1341
                    }
@@ 1343-1347 (lines=5) @@
1340
                        $this->evm->dispatchEvent(Events::postPersist, new LifecycleEventArgs($entry, $this->dm));
1341
                    }
1342
                } else {
1343
                    if ( ! empty($entryClass->lifecycleCallbacks[Events::postUpdate])) {
1344
                        $entryClass->invokeLifecycleCallbacks(Events::postUpdate, $entry, array(
1345
                            new LifecycleEventArgs($entry, $this->dm)
1346
                        ));
1347
                    }
1348
                    if ($hasPostUpdateListeners) {
1349
                        $this->evm->dispatchEvent(Events::postUpdate, new LifecycleEventArgs($entry, $this->dm));
1350
                    }
@@ 1938-1940 (lines=3) @@
1935
                // nothing to do
1936
                break;
1937
            case self::STATE_MANAGED:
1938
                if ( ! empty($class->lifecycleCallbacks[Events::preRemove])) {
1939
                    $class->invokeLifecycleCallbacks(Events::preRemove, $document, array(new LifecycleEventArgs($document, $this->dm)));
1940
                }
1941
                if ($this->evm->hasListeners(Events::preRemove)) {
1942
                    $this->evm->dispatchEvent(Events::preRemove, new LifecycleEventArgs($document, $this->dm));
1943
                }

lib/Doctrine/ODM/MongoDB/Hydrator/HydratorFactory.php 1 location

@@ 459-461 (lines=3) @@
456
        }
457
458
        // Invoke the postLoad lifecycle callbacks and listeners
459
        if ( ! empty($metadata->lifecycleCallbacks[Events::postLoad])) {
460
            $metadata->invokeLifecycleCallbacks(Events::postLoad, $document, array(new LifecycleEventArgs($document, $this->dm)));
461
        }
462
        if ($this->evm->hasListeners(Events::postLoad)) {
463
            $this->evm->dispatchEvent(Events::postLoad, new LifecycleEventArgs($document, $this->dm));
464
        }