setName('thesaurus:find:concepts') ->setDescription('Infer concepts using thesaurus') ->addArgument( 'term', InputArgument::REQUIRED, 'Reverse search a term to infer concepts' ) ->addOption( 'locale', null, InputOption::VALUE_REQUIRED, 'Specify input locale' ) ->addOption( 'raw', null, InputOption::VALUE_NONE, 'Only output raw concepts' ) ; } protected function doExecute(InputInterface $input, OutputInterface $output) { $term = $input->getArgument('term'); $raw = $input->getOption('raw'); if (!$raw) { $output->writeln(sprintf('Finding linked concepts: %s', $term)); $output->writeln(str_repeat('-', 20)); } $thesaurus = $this->container['thesaurus']; $locale = $input->getOption('locale'); $concepts = $thesaurus->findConcepts($term, null, $locale); if (count($concepts)) { $output->writeln($concepts); } elseif (!$raw) { $output->writeln('No concept found'); } } }