Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/Doctrine/ODM/PHPCR/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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,
);
Expand Down
8 changes: 4 additions & 4 deletions lib/Doctrine/ODM/PHPCR/UnitOfWork.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
18 changes: 9 additions & 9 deletions tests/Doctrine/Tests/ODM/PHPCR/Functional/EventComputingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ public function testComputingBetweenEventsWithTranslation()
->getEventManager()
->addEventListener(
array(
Event::preBindTranslation,
Event::postBindTranslation,
Event::preCreateTranslation,
Event::postCreateTranslation,
Event::postLoadTranslation,
Event::preRemoveTranslation,
Event::postRemoveTranslation,
Expand All @@ -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();
Expand All @@ -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');
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ public function testTriggerTranslationEvents()
->getEventManager()
->addEventListener(
array(
Event::preBindTranslation,
Event::postBindTranslation,
Event::preCreateTranslation,
Event::postCreateTranslation,
Event::postLoadTranslation,
Event::preRemoveTranslation,
Event::postRemoveTranslation,
Expand Down Expand Up @@ -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;
}
Expand Down