orderShopBuilder = $orderShopBuilder; $this->openingResolver = $openingResolver; $this->flashBagTranslator = $flashBagTranslator; } public static function getSubscribedEvents() { return [ AfterEntityUpdatedEvent::class => ['processAfterFlushProductFamily'], ]; } public function processAfterFlushProductFamily(AfterEntityUpdatedEvent $event) { $productFamily = $event->getEntityInstance(); if ($productFamily instanceof ProductFamilyInterface) { foreach ($productFamily->getProductFamilySectionProperties() as $productFamilySectionProperty) { $section = $productFamilySectionProperty->getSection(); if (!$this->openingResolver->isOpenSale($section)) { $countOrderProductUpdated = $this->orderShopBuilder->updatePriceByProductFamily($productFamily, $section); if ($countOrderProductUpdated) { $this->flashBagTranslator->add( 'success', 'orderProductUpdated', 'OrderShop', array( '%count%' => $countOrderProductUpdated, '%section%' => $section->getTitle() ) ); } } } } } }