<?php declare(strict_types=1);
namespace SelfdelveBillbee\Subscriber;
use Psr\Log\LoggerInterface;
use Shopware\Core\Content\Product\ProductEvents;
use Shopware\Core\Content\Property\Aggregate\PropertyGroupOption\PropertyGroupOptionCollection;
use Shopware\Core\Framework\Api\Context\AdminApiSource;
use Shopware\Core\Framework\DataAbstractionLayer\Event\EntityLoadedEvent;
use Shopware\Core\Content\Product\ProductEntity;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class ProductWrittenSubscriber implements EventSubscriberInterface
{
private LoggerInterface $logger;
public function __construct(
LoggerInterface $logger
)
{
$this->logger = $logger;
}
public static function getSubscribedEvents(): array
{
return [
ProductEvents::PRODUCT_LOADED_EVENT => 'onProductLoadedEvent',
ProductEvents::PRODUCT_OPTION_LOADED_EVENT => 'onProductOptionLoadedEvent',
];
}
public function onProductLoadedEvent(EntityLoadedEvent $event)
{
// ...
}
public function onProductOptionLoadedEvent(EntityLoadedEvent $event)
{
// ...
}
}