Browse Source

Fixed the problem when we changed the onu status

Jean Sumara 5 years ago
parent
commit
862b58af16
1 changed files with 1 additions and 4 deletions
  1. 1 4
      src/FTTHBundle/EventListener/ONUSubscriber.php

+ 1 - 4
src/FTTHBundle/EventListener/ONUSubscriber.php

@@ -87,10 +87,7 @@ class ONUSubscriber implements EventSubscriber
         try{
             $entity = $args->getEntity();
             if($entity instanceof ONU){
-                $dm = $this->containerInterface->get("doctrine")->getManager();
-                $uow = $dm->getUnitOfWork();
-                $originalEntity = $uow->getOriginalEntityData($entity);
-                if($originalEntity['clientId'] != $entity->getClientId()){
+                if(isset($args->getEntityChangeSet()['clientId']) && $args->getOldValue('clientId') != $entity->getClientId()){
                     $this->setStateOnu($entity);
                 }
             }