From 03ce43d466daf9d085f5b521b223cb8b351a1c0e Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sat, 10 Jun 2017 13:19:43 +0200 Subject: [PATCH] Fix getContainer in command --- src/Wallabag/CoreBundle/Command/CleanDuplicatesCommand.php | 6 +++--- src/Wallabag/CoreBundle/Command/ExportCommand.php | 4 ++-- src/Wallabag/CoreBundle/Command/ShowUserCommand.php | 2 +- src/Wallabag/CoreBundle/Command/TagAllCommand.php | 2 +- src/Wallabag/CoreBundle/Controller/ExportController.php | 1 - 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/Wallabag/CoreBundle/Command/CleanDuplicatesCommand.php b/src/Wallabag/CoreBundle/Command/CleanDuplicatesCommand.php index 89ae7998..74da1e5f 100644 --- a/src/Wallabag/CoreBundle/Command/CleanDuplicatesCommand.php +++ b/src/Wallabag/CoreBundle/Command/CleanDuplicatesCommand.php @@ -46,7 +46,7 @@ class CleanDuplicatesCommand extends ContainerAwareCommand return 1; } } else { - $users = $this->get('wallabag_user.user_repository')->findAll(); + $users = $this->getContainer()->get('wallabag_user.user_repository')->findAll(); $output->writeln(sprintf('Cleaning through %d user accounts', count($users))); @@ -66,7 +66,7 @@ class CleanDuplicatesCommand extends ContainerAwareCommand private function cleanDuplicates(User $user) { $em = $this->getContainer()->get('doctrine.orm.entity_manager'); - $repo = $this->get('wallabag_core.entry_repository'); + $repo = $this->getContainer()->get('wallabag_core.entry_repository'); $entries = $repo->getAllEntriesIdAndUrl($user->getId()); @@ -109,7 +109,7 @@ class CleanDuplicatesCommand extends ContainerAwareCommand */ private function getUser($username) { - return $this->get('wallabag_user.user_repository')->findOneByUserName($username); + return $this->getContainer()->get('wallabag_user.user_repository')->findOneByUserName($username); } private function getDoctrine() diff --git a/src/Wallabag/CoreBundle/Command/ExportCommand.php b/src/Wallabag/CoreBundle/Command/ExportCommand.php index e4977e11..ebb2b4cf 100644 --- a/src/Wallabag/CoreBundle/Command/ExportCommand.php +++ b/src/Wallabag/CoreBundle/Command/ExportCommand.php @@ -32,14 +32,14 @@ class ExportCommand extends ContainerAwareCommand protected function execute(InputInterface $input, OutputInterface $output) { try { - $user = $this->get('wallabag_user.user_repository')->findOneByUserName($input->getArgument('username')); + $user = $this->getContainer()->get('wallabag_user.user_repository')->findOneByUserName($input->getArgument('username')); } catch (NoResultException $e) { $output->writeln(sprintf('User "%s" not found.', $input->getArgument('username'))); return 1; } - $entries = $this->get('wallabag_core.entry_repository') + $entries = $this->getContainer()->get('wallabag_core.entry_repository') ->getBuilderForAllByUser($user->getId()) ->getQuery() ->getResult(); diff --git a/src/Wallabag/CoreBundle/Command/ShowUserCommand.php b/src/Wallabag/CoreBundle/Command/ShowUserCommand.php index 90a7e03f..eef04988 100644 --- a/src/Wallabag/CoreBundle/Command/ShowUserCommand.php +++ b/src/Wallabag/CoreBundle/Command/ShowUserCommand.php @@ -67,7 +67,7 @@ class ShowUserCommand extends ContainerAwareCommand */ private function getUser($username) { - return $this->get('wallabag_user.user_repository')->findOneByUserName($username); + return $this->getContainer()->get('wallabag_user.user_repository')->findOneByUserName($username); } private function getDoctrine() diff --git a/src/Wallabag/CoreBundle/Command/TagAllCommand.php b/src/Wallabag/CoreBundle/Command/TagAllCommand.php index 5a6dc04e..9843674e 100644 --- a/src/Wallabag/CoreBundle/Command/TagAllCommand.php +++ b/src/Wallabag/CoreBundle/Command/TagAllCommand.php @@ -59,7 +59,7 @@ class TagAllCommand extends ContainerAwareCommand */ private function getUser($username) { - return $this->get('wallabag_user.user_repository')->findOneByUserName($username); + return $this->getContainer()->get('wallabag_user.user_repository')->findOneByUserName($username); } private function getDoctrine() diff --git a/src/Wallabag/CoreBundle/Controller/ExportController.php b/src/Wallabag/CoreBundle/Controller/ExportController.php index b9e5a974..e61b6d32 100644 --- a/src/Wallabag/CoreBundle/Controller/ExportController.php +++ b/src/Wallabag/CoreBundle/Controller/ExportController.php @@ -7,7 +7,6 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Wallabag\CoreBundle\Entity\Entry; -use Wallabag\CoreBundle\Entity\Tag; /** * The try/catch can be removed once all formats will be implemented. -- 2.41.0