/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $entries = $this->repository->review(Review::ALL, TRUE); $helper = $this->getHelper('question'); $last = FALSE; foreach ($entries as $entry) { if ($entry->comment && !$input->getOption('recomment')) { continue; } $title = $this->connector->ticketDetails($entry->tid); $question = new Question(sprintf('Enter comment for slot <comment>%d</comment> [<info>%d</info>]: %s [<info>%s h</info>] [%s]', $entry->id, $entry->tid, $title->getTitle(), $entry->duration, $last ?: static::DEFAULT_COMMENT), $last ?: static::DEFAULT_COMMENT); $comment = $helper->ask($input, $output, $question); $this->repository->comment($entry->id, $comment); $last = $comment; } if (!$last) { $output->writeln('<error>All items already commented, use --recomment to recomment</error>'); } }