|
@@ -63,12 +63,15 @@ class DeviceListener
|
|
|
}
|
|
|
|
|
|
$entity = $args->getEntity();
|
|
|
- $cmd_args = array(
|
|
|
- '--type:' . get_class($entity),
|
|
|
- '--id:' . $entity->getId(),
|
|
|
- );
|
|
|
+ if ($entity instanceof DeviceInterface) {
|
|
|
+ $cmd_args = array(
|
|
|
+ '--type:' . get_class($entity),
|
|
|
+ '--id:' . $entity->getId(),
|
|
|
+ );
|
|
|
+
|
|
|
+ return $this->runCommand('device:crud', $cmd_args);
|
|
|
+ }
|
|
|
|
|
|
- return $this->runCommand('device:crud', $cmd_args);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -88,13 +91,14 @@ class DeviceListener
|
|
|
$application->setAutoExit(false);
|
|
|
|
|
|
$input = new ArrayInput(array(
|
|
|
- 'command' => 'amqp:remote',
|
|
|
- 'name' => $name,
|
|
|
- '--args' => $cmd_args,
|
|
|
- '--route' => getenv("AMQP_KEY"),
|
|
|
+ 'command' => 'amqp:remote',
|
|
|
+ 'name' => $name,
|
|
|
+ '--args' => $cmd_args,
|
|
|
+ '--route' => getenv("AMQP_KEY"),
|
|
|
));
|
|
|
|
|
|
$output = new BufferedOutput();
|
|
|
+
|
|
|
$application->run($input, $output);
|
|
|
|
|
|
return $output->fetch();
|
|
@@ -120,7 +124,7 @@ class DeviceListener
|
|
|
'--url:' . $this->deviceDeletePostUrl . $deviceId,
|
|
|
'--method:' . HttpRequestInterface::METHOD_DELETE,
|
|
|
);
|
|
|
-
|
|
|
+
|
|
|
return $this->runCommand('device:crud', $cmd_args);
|
|
|
}
|
|
|
}
|
|
@@ -218,8 +222,6 @@ class DeviceListener
|
|
|
);
|
|
|
$data = $this->webservice->getData("device_post_url", $filters);
|
|
|
|
|
|
-// file_put_contents("/var/flowdat/error.log",json_encode($data));
|
|
|
-
|
|
|
$deviceId = null;
|
|
|
if (isset($data[0])) {
|
|
|
$deviceId = $data[0]['id'];
|