custom/plugins/SelfdelveBillbee/src/Subscriber/ProductWrittenSubscriber.php line 32

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace SelfdelveBillbee\Subscriber;
  3. use Psr\Log\LoggerInterface;
  4. use Shopware\Core\Content\Product\ProductEvents;
  5. use Shopware\Core\Content\Property\Aggregate\PropertyGroupOption\PropertyGroupOptionCollection;
  6. use Shopware\Core\Framework\Api\Context\AdminApiSource;
  7. use Shopware\Core\Framework\DataAbstractionLayer\Event\EntityLoadedEvent;
  8. use Shopware\Core\Content\Product\ProductEntity;
  9. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  10. class ProductWrittenSubscriber implements EventSubscriberInterface
  11. {
  12.     private LoggerInterface $logger;
  13.     public function __construct(
  14.         LoggerInterface $logger
  15.     )
  16.     {
  17.         $this->logger $logger;
  18.     }
  19.     public static function getSubscribedEvents(): array
  20.     {
  21.         return [
  22.             ProductEvents::PRODUCT_LOADED_EVENT => 'onProductLoadedEvent',
  23.             ProductEvents::PRODUCT_OPTION_LOADED_EVENT => 'onProductOptionLoadedEvent',
  24.         ];
  25.     }
  26.     public function onProductLoadedEvent(EntityLoadedEvent $event)
  27.     {
  28.         // ...
  29.     }
  30.     public function onProductOptionLoadedEvent(EntityLoadedEvent $event)
  31.     {
  32.         // ...
  33.     }
  34. }