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
    }
@@ 1035-1037 (lines=3) @@
1032
    private function persistNew(ClassMetadata $class, $document)
1033
    {
1034
        $oid = spl_object_hash($document);
1035
        if ( ! empty($class->lifecycleCallbacks[Events::prePersist])) {
1036
            $class->invokeLifecycleCallbacks(Events::prePersist, $document, array(new LifecycleEventArgs($document, $this->dm)));
1037
        }
1038
        if ($this->evm->hasListeners(Events::prePersist)) {
1039
            $this->evm->dispatchEvent(Events::prePersist, new LifecycleEventArgs($document, $this->dm));
1040
        }
@@ 1115-1117 (lines=3) @@
1112
                    $embeddedClass = $this->dm->getClassMetadata(get_class($embeddedDocument));
1113
                }
1114
1115
                if ( ! empty($embeddedClass->lifecycleCallbacks[Events::postPersist])) {
1116
                    $embeddedClass->invokeLifecycleCallbacks(Events::postPersist, $embeddedDocument, array(new LifecycleEventArgs($document, $this->dm)));
1117
                }
1118
                if ($hasPostPersistListeners) {
1119
                    $this->evm->dispatchEvent(Events::postPersist, new LifecycleEventArgs($embeddedDocument, $this->dm));
1120
                }
@@ 1330-1334 (lines=5) @@
1327
                }
1328
1329
                if (isset($this->documentInsertions[$entryOid])) {
1330
                    if ( ! empty($entryClass->lifecycleCallbacks[Events::postPersist])) {
1331
                        $entryClass->invokeLifecycleCallbacks(Events::postPersist, $entry, array(
1332
                            new LifecycleEventArgs($entry, $this->dm)
1333
                        ));
1334
                    }
1335
                    if ($hasPostPersistListeners) {
1336
                        $this->evm->dispatchEvent(Events::postPersist, new LifecycleEventArgs($entry, $this->dm));
1337
                    }
@@ 1339-1343 (lines=5) @@
1336
                        $this->evm->dispatchEvent(Events::postPersist, new LifecycleEventArgs($entry, $this->dm));
1337
                    }
1338
                } else {
1339
                    if ( ! empty($entryClass->lifecycleCallbacks[Events::postUpdate])) {
1340
                        $entryClass->invokeLifecycleCallbacks(Events::postUpdate, $entry, array(
1341
                            new LifecycleEventArgs($entry, $this->dm)
1342
                        ));
1343
                    }
1344
                    if ($hasPostUpdateListeners) {
1345
                        $this->evm->dispatchEvent(Events::postUpdate, new LifecycleEventArgs($entry, $this->dm));
1346
                    }
@@ 1934-1936 (lines=3) @@
1931
                // nothing to do
1932
                break;
1933
            case self::STATE_MANAGED:
1934
                if ( ! empty($class->lifecycleCallbacks[Events::preRemove])) {
1935
                    $class->invokeLifecycleCallbacks(Events::preRemove, $document, array(new LifecycleEventArgs($document, $this->dm)));
1936
                }
1937
                if ($this->evm->hasListeners(Events::preRemove)) {
1938
                    $this->evm->dispatchEvent(Events::preRemove, new LifecycleEventArgs($document, $this->dm));
1939
                }

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
        }