X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=src%2FWallabag%2FCoreBundle%2FCommand%2FTagAllCommand.php;h=4afac2d45808fb5ee69e559afb59585538b2cae1;hb=a991c46eedec0efb24d0a9974b1c7fcabf8cfa66;hp=3f9bb04d9f29b72a53ee0391711013094c6c8003;hpb=8eeefc658c500c0839512ac2e259e194ab943d2c;p=github%2Fwallabag%2Fwallabag.git
diff --git a/src/Wallabag/CoreBundle/Command/TagAllCommand.php b/src/Wallabag/CoreBundle/Command/TagAllCommand.php
index 3f9bb04d..4afac2d4 100644
--- a/src/Wallabag/CoreBundle/Command/TagAllCommand.php
+++ b/src/Wallabag/CoreBundle/Command/TagAllCommand.php
@@ -7,6 +7,7 @@ use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Console\Style\SymfonyStyle;
class TagAllCommand extends ContainerAwareCommand
{
@@ -25,21 +26,22 @@ class TagAllCommand extends ContainerAwareCommand
protected function execute(InputInterface $input, OutputInterface $output)
{
+ $io = new SymfonyStyle($input, $output);
+
try {
$user = $this->getUser($input->getArgument('username'));
} catch (NoResultException $e) {
- $output->writeln(sprintf('User "%s" not found.', $input->getArgument('username')));
+ $io->error(sprintf('User "%s" not found.', $input->getArgument('username')));
return 1;
}
$tagger = $this->getContainer()->get('wallabag_core.rule_based_tagger');
- $output->write(sprintf('Tagging entries for user « %s »... ', $user->getUserName()));
+ $io->text(sprintf('Tagging entries for user %s...', $user->getUserName()));
$entries = $tagger->tagAllForUser($user);
- $output->writeln('Done.');
- $output->write(sprintf('Persist entries ... ', $user->getUserName()));
+ $io->text('Persist entries... ');
$em = $this->getDoctrine()->getManager();
foreach ($entries as $entry) {
@@ -47,7 +49,9 @@ class TagAllCommand extends ContainerAwareCommand
}
$em->flush();
- $output->writeln('Done.');
+ $io->success('Done.');
+
+ return 0;
}
/**
@@ -59,7 +63,7 @@ class TagAllCommand extends ContainerAwareCommand
*/
private function getUser($username)
{
- return $this->getDoctrine()->getRepository('WallabagUserBundle:User')->findOneByUserName($username);
+ return $this->getContainer()->get('wallabag_user.user_repository')->findOneByUserName($username);
}
private function getDoctrine()