importGeoNames = $importGeoNames; } /** * @inheritdoc */ protected function configure() { $this->setName('inventory-geonames:import') ->setDescription('Download and import geo names for source selection algorithm') ->setDefinition([ new InputArgument( self::COUNTRIES, InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'List of country codes to import' ) ]); parent::configure(); } /** * @inheritdoc */ protected function execute(InputInterface $input, OutputInterface $output) { $countries = $input->getArgument(self::COUNTRIES); foreach ($countries as $country) { $output->write('Importing ' . $country . ': '); try { $this->importGeoNames->execute($country); $output->writeln('OK'); } catch (\Exception $e) { $output->writeln($e->getMessage()); } } $output->writeln('Done.'); } }