Browse Source

Fixed the problem when we changed the onu status

Jean Sumara 5 năm trước cách đây
mục cha
commit
862b58af16
1 tập tin đã thay đổi với 1 bổ sung4 xóa
  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);
                 }
             }