/** * @inheritdoc */ public function findById($sourceId) { if (null === ($source = $this->findCachedById($sourceId))) { $source = $this->sourceManager->findById($sourceId); $this->cache($source); } return $source; }
/** * @inheritdoc */ protected function execute(InputInterface $input, OutputInterface $output) { $id = $input->getArgument('id'); if (null === ($source = $this->sourceManager->findById($id))) { $output->writeln(sprintf('<error>Could not find source with id %d</error>', $id)); return 1; } $linked = $this->sourceProcessor->isLinked($source); if (!$linked) { $output->writeln('Linking source first'); $this->sourceProcessor->link($source); } $this->sourceProcessor->process($source); $this->sourceManager->flush($source); $output->writeln(sprintf('Source <info>%d</info> has been processed', $id)); return 0; }
/** * @param int $sourceId * * @return SourceInterface */ protected function findSource($sourceId) { return $this->sourceManager->findById($sourceId); }