src/EventSubscriber/Product/ProductSymbolResourceSubscriber.php line 30

  1. <?php
  2. namespace App\EventSubscriber\Product;
  3. use Symfony\Component\HttpFoundation\RequestStack;
  4. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  5. use Symfony\Component\EventDispatcher\GenericEvent;
  6. use Webmozart\Assert\Assert;
  7. use Sylius\Component\Customer\Model\CustomerInterface;
  8. use App\Repository\Customer\CustomerRepository;
  9. use App\Entity\Channel\ChannelEcodaAccountInfo;
  10. use App\Entity\Product\ProductSymbol;
  11. use App\Repository\Channel\ChannelEcodaAccountInfoRepository;
  12. use App\Repository\Channel\ChannelEcodaAccountTypeRepository;
  13. use Doctrine\ORM\EntityManagerInterface;
  14. use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
  15. use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
  16. use App\Manager\EcodaAccountManager;
  17. use App\Entity\Product\ProductVariant;
  18. class ProductSymbolResourceSubscriber  implements EventSubscriberInterface
  19.      
  20.     public function onAppEntityPreCreate(GenericEvent $event)
  21.     {  
  22.         $entity $event->getSubject();  
  23.         Assert::isInstanceOf($entityProductSymbol::class);  
  24.     } 
  25.     public function onAppEntityPreUpdate(GenericEvent $event)
  26.     {   
  27.         $entity $event->getSubject();  
  28.         Assert::isInstanceOf($entityProductSymbol::class);  
  29.     } 
  30.  
  31.     public static function getSubscribedEvents()
  32.     {
  33.         return [
  34.            'app.product_symbol.pre_create' => 'onAppEntityPreCreate'
  35.            'app.product_symbol.pre_update' => 'onAppEntityPreUpdate'
  36.         ];
  37.     }
  38. }