setName('stats:devices') ->setDescription('Stats Devices command') ->setHelp('This command allows you to get and update stats devices list from devices server url') ; } /** * @param InputInterface $input * @param OutputInterface $output */ protected function execute(InputInterface $input, OutputInterface $output) { /* @var $statsDeviceManager DeviceManager */ $statsDeviceManager = $this->getContainer()->get('stats.device.manager'); $devices = $statsDeviceManager->getDevices(); if (count($devices)) { $output->writeln('Nuevos StatsDevice:'); foreach ($devices as $device) { $output->writeln(sprintf('DeviceType: %s DeviceIp: %s', $device->getDeviceType(), $device->getIp())); } } else { $output->writeln('No hay nuevos StatsDevice'); } } }