1414use Shopware \Core \Checkout \Cart \Event \CheckoutOrderPlacedEvent ;
1515use Shopware \Core \Checkout \Order \Aggregate \OrderLineItem \OrderLineItemEntity ;
1616use Shopware \Core \Content \Product \ProductCollection ;
17- use Shopware \Core \Content \Product \ProductEntity ;
1817use Shopware \Core \Framework \DataAbstractionLayer \EntityRepository ;
1918use Shopware \Core \Framework \DataAbstractionLayer \Search \Criteria ;
2019use Shopware \Core \System \SystemConfig \SystemConfigService ;
2322
2423class OrderPlacedSubscriber implements EventSubscriberInterface
2524{
25+ /**
26+ * @param EntityRepository<ProductCollection> $productRepository
27+ */
2628 public function __construct (
2729 private readonly EntityRepository $ productRepository ,
2830 private readonly EsdOrderService $ esdOrderService ,
@@ -31,6 +33,9 @@ public function __construct(
3133 ) {
3234 }
3335
36+ /**
37+ * @return array<string, string>
38+ */
3439 public static function getSubscribedEvents (): array
3540 {
3641 return [
@@ -57,11 +62,9 @@ public function handle(CheckoutOrderPlacedEvent $event): void
5762 $ criteria = new Criteria ($ productIds );
5863 $ criteria ->addAssociation ('esd.esdMedia ' );
5964
60- /** @var ProductCollection $products */
6165 $ products = $ this ->productRepository ->search ($ criteria , $ event ->getContext ())->getEntities ();
6266
6367 $ esdProducts = new ProductCollection ();
64- /** @var ProductEntity $product */
6568 foreach ($ products as $ product ) {
6669 $ esd = $ product ->getExtension ('esd ' );
6770 if (!$ esd instanceof EsdEntity) {
@@ -89,7 +92,7 @@ public function handle(CheckoutOrderPlacedEvent $event): void
8992 $ templateData = $ this ->esdOrderService ->mailTemplateData ($ event ->getOrder (), $ event ->getContext ());
9093
9194 if (!empty ($ templateData ['esdOrderLineItems ' ])) {
92- if ($ this ->getSystemConfig (EsdMailTemplate:: TEMPLATE_DOWNLOAD_DISABLED_ZIP_SYSTEM_CONFIG_NAME )) {
95+ if ($ this ->getSystemConfig ()) {
9396 $ event = new EsdDownloadPaymentStatusPaidDisabledZipEvent (
9497 $ event ->getContext (),
9598 $ event ->getOrder (),
@@ -109,9 +112,9 @@ public function handle(CheckoutOrderPlacedEvent $event): void
109112 }
110113 }
111114
112- private function getSystemConfig (string $ name ): bool
115+ private function getSystemConfig (): bool
113116 {
114- $ config = $ this ->systemConfigService ->get ('SasEsd.config. ' . $ name );
117+ $ config = $ this ->systemConfigService ->get ('SasEsd.config. ' . EsdMailTemplate:: TEMPLATE_DOWNLOAD_DISABLED_ZIP_SYSTEM_CONFIG_NAME );
115118 if (empty ($ config )) {
116119 return false ;
117120 }
0 commit comments