Skip to content

Commit

Permalink
Subscriber for Author/Authored
Browse files Browse the repository at this point in the history
  • Loading branch information
manuxi committed Mar 29, 2021
1 parent 3790214 commit 23d9d62
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/EventSubscriber/ORM/AuthorSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Doctrine\ORM\Events;
use Doctrine\Persistence\Event\LoadClassMetadataEventArgs;
use Manuxi\SuluEventBundle\Entity\Interfaces\AuthorInterface;
use Manuxi\SuluEventBundle\Entity\Interfaces\AuthorTranslationInterface;
use Sulu\Component\Security\Authentication\UserInterface;
use Symfony\Component\Security\Core\Authentication\Token\AnonymousToken;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
Expand Down Expand Up @@ -36,6 +37,14 @@ public function __construct($userClass, TokenStorageInterface $tokenStorage = nu
$this->userClass = $userClass;
}

public function getSubscribedEvents()
{
return [
Events::loadClassMetadata,
Events::onFlush,
];
}

/**
* Map creator and changer fields to User objects.
*/
Expand Down Expand Up @@ -133,11 +142,4 @@ private function getUser(TokenInterface $token)
return $user;
}

public function getSubscribedEvents()
{
return [
Events::loadClassMetadata,
Events::onFlush,
];
}
}

0 comments on commit 23d9d62

Please sign in to comment.