vendor/sylius/sylius/src/Sylius/Bundle/CoreBundle/EventListener/PasswordUpdaterListener.php line 26

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\CoreBundle\EventListener;
  12. use Sylius\Bundle\UserBundle\EventListener\PasswordUpdaterListener as BasePasswordUpdaterListener;
  13. use Sylius\Component\Core\Model\CustomerInterface;
  14. use Symfony\Component\EventDispatcher\GenericEvent;
  15. use Webmozart\Assert\Assert;
  16. final class PasswordUpdaterListener extends BasePasswordUpdaterListener
  17. {
  18.     /**
  19.      * @throws \InvalidArgumentException
  20.      */
  21.     public function customerUpdateEvent(GenericEvent $event): void
  22.     {
  23.         $customer $event->getSubject();
  24.         /** @var CustomerInterface $customer */
  25.         Assert::isInstanceOf($customerCustomerInterface::class);
  26.         $user $customer->getUser();
  27.         if (null !== $user) {
  28.             $this->updatePassword($user);
  29.         }
  30.     }
  31. }