Explorar o código

FD-1676 se asigna los service ports en postupdate

Espinoza Guillermo %!s(int64=6) %!d(string=hai) anos
pai
achega
9f812ae6fd
Modificáronse 1 ficheiros con 14 adicións e 0 borrados
  1. 14 0
      src/FTTHBundle/EventListener/ONUSubscriber.php

+ 14 - 0
src/FTTHBundle/EventListener/ONUSubscriber.php

@@ -49,6 +49,7 @@ class ONUSubscriber implements EventSubscriber
             DoctrineEvents::PRE_PERSIST,
             DoctrineEvents::POST_PERSIST,
             DoctrineEvents::PRE_UPDATE,
+            DoctrineEvents::POST_UPDATE,
         );
     }
 
@@ -79,6 +80,19 @@ class ONUSubscriber implements EventSubscriber
     {
         $this->execute($args, DoctrineEvents::PRE_UPDATE);
     }
+    
+    
+    /**
+     * @param LifecycleEventArgs $args
+     */
+    public function postUpdate(LifecycleEventArgs $args)
+    {
+        $entity = $args->getEntity();
+        if ($entity instanceof ONU) {
+            $this->em = $args->getEntityManager();
+            $this->setServicePorts($entity);
+        }
+    }
 
     /**
      * @param LifecycleEventArgs $args