Przeglądaj źródła

Refactory listener. Se agrego método en Interface

Guillermo Espinoza 8 lat temu
rodzic
commit
bf1029b73d

+ 2 - 6
EventListener/DeviceListener.php

@@ -55,7 +55,7 @@ class DeviceListener
     }
 
     /**
-     * @param LifecycleEventArgs $arg
+     * @param LifecycleEventArgs $args
      * @param string $url
      * @param string $method
      */
@@ -63,11 +63,7 @@ class DeviceListener
     {
         $entity = $args->getEntity();
         if ($entity instanceof DeviceInterface) {
-            $data = array(
-                'deviceType' => get_class($entity),
-                'deviceId' => $entity->getId(),
-                'ip' => $entity->getIp(),
-            );
+            $data = $entity->getDeviceData();
 
             return $this->webservice->makeGetRequest($url, $method, $data);
         }

+ 2 - 0
Interfaces/DeviceInterface.php

@@ -4,4 +4,6 @@ namespace DeviceBundle\Interfaces;
 
 interface DeviceInterface
 {
+
+    public function getDeviceData();
 }