You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- <?php
-
- namespace domain\Product\Rotating\Event;
-
- use domain\Product\Rotating\Rotating;
- use domain\Product\Rotating\RotatingModule;
- use justcoded\yii2\eventlistener\observers\Observer;
- use yii\base\ErrorException;
-
- class RotatingObserver extends Observer
- {
- public function events(): array
- {
- return [
- RotatingSaveEvent::NAME => 'onRotatingSave'
- ];
- }
-
- /**
- * @throws ErrorException
- */
- public function onRotatingSave(RotatingSaveEvent $event)
- {
- $rotatingModule = RotatingModule::getInstance();
- $rotating = $event->rotating;
-
- // Obligé de recharger le Rotating
- $rotating = $rotatingModule->getRepository()->findOneRotatingById($rotating->getId());
- $rotatingModule->getManager()->initializeRotatingInDistributionsIncoming($rotating);
- }
- }
|