Skip to content

Commit

Permalink
better message
Browse files Browse the repository at this point in the history
  • Loading branch information
SergioMendolia committed Oct 13, 2023
1 parent acbe3af commit b87fed4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Command/BooksTagCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,19 @@ protected function execute(InputInterface $input, OutputInterface $output): int
continue;
}

$io->writeln('looking for suggestions for '.$book->getTitle());

$suggestions = $this->bookSuggestions->getCategorySuggestions($book);
if (count($suggestions['tags']) === 0) {
$suggestions = $this->bookSuggestions->getGoogleSuggestions($book);
}
if(count($suggestions['tags']) > 0){
$io->writeln('- tags found for '.$book->getTitle());
$io->writeln('- tags found');
$book->setTags(array_values($suggestions['tags']));
}
$summary = count($suggestions['summary']) > 0 ? current($suggestions['summary']) : '';
if ($summary !== '' && ($book->getSummary() === null || $book->getSummary() === '')) {
$io->writeln('- summary found for '.$book->getTitle());
$io->writeln('- summary found');
$book->setSummary($summary);
}
$this->entityManager->flush();
Expand Down

0 comments on commit b87fed4

Please sign in to comment.