vendor/sylius/sylius/src/Sylius/Bundle/UserBundle/EventListener/UserReloaderListener.php line 30

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Sylius package.
  4.  *
  5.  * (c) Paweł Jędrzejewski
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. declare(strict_types=1);
  11. namespace Sylius\Bundle\UserBundle\EventListener;
  12. use Sylius\Bundle\UserBundle\Reloader\UserReloaderInterface;
  13. use Sylius\Component\User\Model\UserInterface;
  14. use Symfony\Component\EventDispatcher\GenericEvent;
  15. use Webmozart\Assert\Assert;
  16. final class UserReloaderListener
  17. {
  18.     private UserReloaderInterface $userReloader;
  19.     public function __construct(UserReloaderInterface $userReloader)
  20.     {
  21.         $this->userReloader $userReloader;
  22.     }
  23.     public function reloadUser(GenericEvent $event): void
  24.     {
  25.         $user $event->getSubject();
  26.         Assert::isInstanceOf($userUserInterface::class);
  27.         $this->userReloader->reloadUser($user);
  28.     }
  29. }