Selaa lähdekoodia

FD3-229 Se cambio el argument type a option

Guillermo Espinoza 7 vuotta sitten
vanhempi
commit
a96f4e0d49
2 muutettua tiedostoa jossa 5 lisäystä ja 6 poistoa
  1. 2 2
      Command/CRUDDeviceCommand.php
  2. 3 4
      EventListener/DeviceListener.php

+ 2 - 2
Command/CRUDDeviceCommand.php

@@ -17,7 +17,7 @@ class CRUDDeviceCommand extends ContainerAwareCommand
             ->setName('device:crud')
             ->setDescription('CRUD Device command')
             ->setHelp('Create, update or delete a device')
-            ->addArgument('type', InputOption::VALUE_REQUIRED, 'Device Type. e.g. FTTHBundle:ONU, FTTHBundle:OLT')
+            ->addOption('type', null, InputOption::VALUE_REQUIRED, 'Device Type. e.g. FTTHBundle:ONU, FTTHBundle:OLT')
             ->addOption('id', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'Device id. e.g. --id=1 --id=2')
             ->addOption('url', null, InputOption::VALUE_OPTIONAL, 'Device POST | PUT | DELETE url for device creation')
             ->addOption('method', null, InputOption::VALUE_OPTIONAL, 'Http method. e.g. POST, PUT, DELETE', HttpRequestInterface::METHOD_POST)
@@ -32,7 +32,7 @@ class CRUDDeviceCommand extends ContainerAwareCommand
      */
     protected function execute(InputInterface $input, OutputInterface $output)
     {
-        $type = $input->getArgument('type');
+        $type = $input->getOption('type');
         $ids = $input->getOption('id');
         $url = $input->getOption('url');
         $method = $input->getOption('method');

+ 3 - 4
EventListener/DeviceListener.php

@@ -9,7 +9,6 @@ use Buzz\Message\RequestInterface as HttpRequestInterface;
 use Symfony\Bundle\FrameworkBundle\Console\Application;
 use Symfony\Component\Console\Input\ArrayInput;
 use Symfony\Component\Console\Output\BufferedOutput;
-use Symfony\Component\HttpKernel\KernelInterface;
 
 class DeviceListener
 {
@@ -65,7 +64,7 @@ class DeviceListener
 
         $entity = $args->getEntity();
         $cmd_args = array(
-            'type:' . get_class($entity),
+            '--type:' . get_class($entity),
             '--id:' . $entity->getId(),
         );
         
@@ -115,7 +114,7 @@ class DeviceListener
         if ($entity instanceof DeviceInterface) {
             if ($deviceId = $this->getRemoteDeviceId($entity)) {
                 $cmd_args = array(
-                    'type:' . get_class($entity),
+                    '--type:' . get_class($entity),
                     '--id:' . $entity->getId(),
                     '--url:' . $this->deviceDeletePostUrl,
                     '--method:' . HttpRequestInterface::METHOD_DELETE,
@@ -138,7 +137,7 @@ class DeviceListener
         $entity = $args->getEntity();
         if ($entity instanceof DeviceInterface) {
             $cmd_args = array(
-                'type:' . get_class($entity),
+                '--type:' . get_class($entity),
                 '--id:' . $entity->getId(),
             );
             if ($deviceId = $this->getRemoteDeviceId($entity)) {