Skip to content

Commit

Permalink
Fixed doctrine listener arguments (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
paullla authored Oct 22, 2020
1 parent 57c7fb9 commit 79fcf8b
Showing 1 changed file with 4 additions and 19 deletions.
23 changes: 4 additions & 19 deletions src/EventListener/AssignLocaleListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Locastic\ApiPlatformTranslationBundle\EventListener;

use Doctrine\Common\Persistence\Event\LifecycleEventArgs;
use Doctrine\Common\EventArgs;
use Locastic\ApiPlatformTranslationBundle\Model\TranslatableInterface;
use Locastic\ApiPlatformTranslationBundle\Translation\Translator;

Expand All @@ -25,38 +25,23 @@ class AssignLocaleListener
*/
private $defaultLocale;

/**
* AssignLocaleListener constructor.
*
* @param Translator $translator
* @param string $defaultLocale
*/
public function __construct(Translator $translator, string $defaultLocale = 'en')
{
$this->translator = $translator;
$this->defaultLocale = $defaultLocale;
}

/**
* @param LifecycleEventArgs $args
*/
public function postLoad(LifecycleEventArgs $args): void
public function postLoad(EventArgs $args): void
{
$this->assignLocale($args);
}

/**
* @param LifecycleEventArgs $args
*/
public function prePersist(LifecycleEventArgs $args): void
public function prePersist(EventArgs $args): void
{
$this->assignLocale($args);
}

/**
* @param LifecycleEventArgs $args
*/
private function assignLocale(LifecycleEventArgs $args): void
private function assignLocale(EventArgs $args): void
{
$object = $args->getObject();

Expand Down

0 comments on commit 79fcf8b

Please sign in to comment.