vendor/shopware/core/System/SalesChannel/Entity/SalesChannelEntityLoadedEvent.php line 39

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Shopware\Core\System\SalesChannel\Entity;
  3. use Shopware\Core\Framework\DataAbstractionLayer\EntityDefinition;
  4. use Shopware\Core\Framework\DataAbstractionLayer\Event\EntityLoadedEvent;
  5. use Shopware\Core\Framework\Event\ShopwareSalesChannelEvent;
  6. use Shopware\Core\Framework\Feature;
  7. use Shopware\Core\Framework\Log\Package;
  8. use Shopware\Core\System\SalesChannel\SalesChannelContext;
  9. #[Package('sales-channel')]
  10. class SalesChannelEntityLoadedEvent extends EntityLoadedEvent implements ShopwareSalesChannelEvent
  11. {
  12. /**
  13. * @var SalesChannelContext
  14. */
  15. private $salesChannelContext;
  16. public function __construct(EntityDefinition $definition, array $entities, SalesChannelContext $context, bool $nested = true)
  17. {
  18. parent::__construct($definition, $entities, $context->getContext(), $nested);
  19. $this->salesChannelContext = $context;
  20. }
  21. public function getName(): string
  22. {
  23. return 'sales_channel.' . parent::getName();
  24. }
  25. public function getSalesChannelContext(): SalesChannelContext
  26. {
  27. return $this->salesChannelContext;
  28. }
  29. /**
  30. * @deprecated tag:v6.5.0 (flag:FEATURE_NEXT_16155) - remove all code below in this function. Nested loaded events are generated over EntityLoadedEventFactory
  31. */
  32. protected function createNested(EntityDefinition $definition, array $entities): EntityLoadedEvent
  33. {
  34. Feature::triggerDeprecationOrThrow(
  35. 'v6.5.0.0',
  36. Feature::deprecatedMethodMessage(__CLASS__, __METHOD__, 'v6.5.0.0', 'EntityLoadedEventFactory')
  37. );
  38. return new self($definition, $entities, $this->salesChannelContext, false);
  39. }
  40. }