diff --git a/lib/Doctrine/ODM/PHPCR/Event.php b/lib/Doctrine/ODM/PHPCR/Event.php index 90ab4e5dd..35b938d29 100644 --- a/lib/Doctrine/ODM/PHPCR/Event.php +++ b/lib/Doctrine/ODM/PHPCR/Event.php @@ -39,8 +39,8 @@ final class Event const loadClassMetadata = 'loadClassMetadata'; const postLoadTranslation = 'postLoadTranslation'; - const preBindTranslation = 'preBindTranslation'; - const postBindTranslation = 'postBindTranslation'; + const preCreateTranslation = 'preCreateTranslation'; + const postCreateTranslation = 'postCreateTranslation'; const preRemoveTranslation = 'preRemoveTranslation'; const postRemoveTranslation = 'postRemoveTranslation'; @@ -55,8 +55,8 @@ final class Event self::postMove => self::postMove, self::postLoad => self::postLoad, self::postLoadTranslation => self::postLoadTranslation, - self::preBindTranslation => self::preBindTranslation, - self::postBindTranslation => self::postBindTranslation, + self::preCreateTranslation => self::preCreateTranslation, + self::postCreateTranslation => self::postCreateTranslation, self::preRemoveTranslation => self::preRemoveTranslation, self::postRemoveTranslation => self::postRemoveTranslation, ); diff --git a/lib/Doctrine/ODM/PHPCR/UnitOfWork.php b/lib/Doctrine/ODM/PHPCR/UnitOfWork.php index aaa0e3027..67a359f9a 100644 --- a/lib/Doctrine/ODM/PHPCR/UnitOfWork.php +++ b/lib/Doctrine/ODM/PHPCR/UnitOfWork.php @@ -722,10 +722,10 @@ public function bindTranslation($document, $locale) private function doBindTranslation($document, $locale, ClassMetadata $class, $supressEvents = false) { - if (!$supressEvents && $invoke = $this->eventListenersInvoker->getSubscribedSystems($class, Event::preBindTranslation)) { + if (!$supressEvents && $invoke = $this->eventListenersInvoker->getSubscribedSystems($class, Event::preCreateTranslation)) { $this->eventListenersInvoker->invoke( $class, - Event::preBindTranslation, + Event::preCreateTranslation, $document, new LifecycleEventArgs($document, $this->dm), $invoke @@ -740,10 +740,10 @@ private function doBindTranslation($document, $locale, ClassMetadata $class, $su $this->documentTranslations[$oid][$locale][$field] = $class->reflFields[$field]->getValue($document); } - if (!$supressEvents && $invoke = $this->eventListenersInvoker->getSubscribedSystems($class, Event::postBindTranslation)) { + if (!$supressEvents && $invoke = $this->eventListenersInvoker->getSubscribedSystems($class, Event::postCreateTranslation)) { $this->eventListenersInvoker->invoke( $class, - Event::postBindTranslation, + Event::postCreateTranslation, $document, new LifecycleEventArgs($document, $this->dm), $invoke diff --git a/tests/Doctrine/Tests/ODM/PHPCR/Functional/EventComputingTest.php b/tests/Doctrine/Tests/ODM/PHPCR/Functional/EventComputingTest.php index 3c9066002..a71d3c29d 100644 --- a/tests/Doctrine/Tests/ODM/PHPCR/Functional/EventComputingTest.php +++ b/tests/Doctrine/Tests/ODM/PHPCR/Functional/EventComputingTest.php @@ -115,8 +115,8 @@ public function testComputingBetweenEventsWithTranslation() ->getEventManager() ->addEventListener( array( - Event::preBindTranslation, - Event::postBindTranslation, + Event::preCreateTranslation, + Event::postCreateTranslation, Event::postLoadTranslation, Event::preRemoveTranslation, Event::postRemoveTranslation, @@ -133,9 +133,9 @@ public function testComputingBetweenEventsWithTranslation() $this->dm->persist($user); - // postBindTranslation event should change the name to bindTranslation + // postCreateTranslation event should change the name to bindTranslation $this->dm->bindTranslation($user, 'en'); - $this->assertEquals('postBindTranslation', $user->username); + $this->assertEquals('postCreateTranslation', $user->username); $this->dm->flush(); $this->dm->clear(); @@ -146,7 +146,7 @@ public function testComputingBetweenEventsWithTranslation() $this->assertEquals('loadTranslation', $user->username); // name had been changed pre binding translation - $this->assertEquals('preBindTranslation', $user->name); + $this->assertEquals('preCreateTranslation', $user->name); $this->dm->name = 'neuer Name'; $this->dm->bindTranslation($user, 'de'); @@ -215,16 +215,16 @@ public function postMove(LifecycleEventArgs $e) $document->username .= '-postmove'; } - public function preBindTranslation(LifecycleEventArgs $e) + public function preCreateTranslation(LifecycleEventArgs $e) { $document = $e->getObject(); - $document->name = 'preBindTranslation'; + $document->name = 'preCreateTranslation'; } - public function postBindTranslation(LifecycleEventArgs $e) + public function postCreateTranslation(LifecycleEventArgs $e) { $document = $e->getObject(); - $document->username = 'postBindTranslation'; + $document->username = 'postCreateTranslation'; } public function postLoadTranslation(LifecycleEventArgs $e) diff --git a/tests/Doctrine/Tests/ODM/PHPCR/Functional/EventManagerTest.php b/tests/Doctrine/Tests/ODM/PHPCR/Functional/EventManagerTest.php index 26ec386ce..0a335cc04 100644 --- a/tests/Doctrine/Tests/ODM/PHPCR/Functional/EventManagerTest.php +++ b/tests/Doctrine/Tests/ODM/PHPCR/Functional/EventManagerTest.php @@ -155,8 +155,8 @@ public function testTriggerTranslationEvents() ->getEventManager() ->addEventListener( array( - Event::preBindTranslation, - Event::postBindTranslation, + Event::preCreateTranslation, + Event::postCreateTranslation, Event::postLoadTranslation, Event::preRemoveTranslation, Event::postRemoveTranslation, @@ -340,12 +340,12 @@ public function preFlush(ManagerEventArgs $e) $this->preFlush = true; } - public function preBindTranslation(LifecycleEventArgs $e) + public function preCreateTranslation(LifecycleEventArgs $e) { $this->preBindTranslation = true; } - public function postBindTranslation(LifecycleEventArgs $e) + public function postCreateTranslation(LifecycleEventArgs $e) { $this->postBindTranslation = true; }