diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2017-06-10 13:19:43 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2017-06-21 11:44:35 +0200 |
commit | 03ce43d466daf9d085f5b521b223cb8b351a1c0e (patch) | |
tree | 589f7214e47c782d61a3e780e10f93788b7df674 /src | |
parent | 18c38dffc67d04e59a9cc26b6910d9b9a4a49cd6 (diff) | |
download | wallabag-03ce43d466daf9d085f5b521b223cb8b351a1c0e.tar.gz wallabag-03ce43d466daf9d085f5b521b223cb8b351a1c0e.tar.zst wallabag-03ce43d466daf9d085f5b521b223cb8b351a1c0e.zip |
Fix getContainer in command
Diffstat (limited to 'src')
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 | |||
46 | return 1; | 46 | return 1; |
47 | } | 47 | } |
48 | } else { | 48 | } else { |
49 | $users = $this->get('wallabag_user.user_repository')->findAll(); | 49 | $users = $this->getContainer()->get('wallabag_user.user_repository')->findAll(); |
50 | 50 | ||
51 | $output->writeln(sprintf('Cleaning through %d user accounts', count($users))); | 51 | $output->writeln(sprintf('Cleaning through %d user accounts', count($users))); |
52 | 52 | ||
@@ -66,7 +66,7 @@ class CleanDuplicatesCommand extends ContainerAwareCommand | |||
66 | private function cleanDuplicates(User $user) | 66 | private function cleanDuplicates(User $user) |
67 | { | 67 | { |
68 | $em = $this->getContainer()->get('doctrine.orm.entity_manager'); | 68 | $em = $this->getContainer()->get('doctrine.orm.entity_manager'); |
69 | $repo = $this->get('wallabag_core.entry_repository'); | 69 | $repo = $this->getContainer()->get('wallabag_core.entry_repository'); |
70 | 70 | ||
71 | $entries = $repo->getAllEntriesIdAndUrl($user->getId()); | 71 | $entries = $repo->getAllEntriesIdAndUrl($user->getId()); |
72 | 72 | ||
@@ -109,7 +109,7 @@ class CleanDuplicatesCommand extends ContainerAwareCommand | |||
109 | */ | 109 | */ |
110 | private function getUser($username) | 110 | private function getUser($username) |
111 | { | 111 | { |
112 | return $this->get('wallabag_user.user_repository')->findOneByUserName($username); | 112 | return $this->getContainer()->get('wallabag_user.user_repository')->findOneByUserName($username); |
113 | } | 113 | } |
114 | 114 | ||
115 | private function getDoctrine() | 115 | 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 | |||
32 | protected function execute(InputInterface $input, OutputInterface $output) | 32 | protected function execute(InputInterface $input, OutputInterface $output) |
33 | { | 33 | { |
34 | try { | 34 | try { |
35 | $user = $this->get('wallabag_user.user_repository')->findOneByUserName($input->getArgument('username')); | 35 | $user = $this->getContainer()->get('wallabag_user.user_repository')->findOneByUserName($input->getArgument('username')); |
36 | } catch (NoResultException $e) { | 36 | } catch (NoResultException $e) { |
37 | $output->writeln(sprintf('<error>User "%s" not found.</error>', $input->getArgument('username'))); | 37 | $output->writeln(sprintf('<error>User "%s" not found.</error>', $input->getArgument('username'))); |
38 | 38 | ||
39 | return 1; | 39 | return 1; |
40 | } | 40 | } |
41 | 41 | ||
42 | $entries = $this->get('wallabag_core.entry_repository') | 42 | $entries = $this->getContainer()->get('wallabag_core.entry_repository') |
43 | ->getBuilderForAllByUser($user->getId()) | 43 | ->getBuilderForAllByUser($user->getId()) |
44 | ->getQuery() | 44 | ->getQuery() |
45 | ->getResult(); | 45 | ->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 | |||
67 | */ | 67 | */ |
68 | private function getUser($username) | 68 | private function getUser($username) |
69 | { | 69 | { |
70 | return $this->get('wallabag_user.user_repository')->findOneByUserName($username); | 70 | return $this->getContainer()->get('wallabag_user.user_repository')->findOneByUserName($username); |
71 | } | 71 | } |
72 | 72 | ||
73 | private function getDoctrine() | 73 | 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 | |||
59 | */ | 59 | */ |
60 | private function getUser($username) | 60 | private function getUser($username) |
61 | { | 61 | { |
62 | return $this->get('wallabag_user.user_repository')->findOneByUserName($username); | 62 | return $this->getContainer()->get('wallabag_user.user_repository')->findOneByUserName($username); |
63 | } | 63 | } |
64 | 64 | ||
65 | private function getDoctrine() | 65 | 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; | |||
7 | use Symfony\Component\HttpFoundation\Request; | 7 | use Symfony\Component\HttpFoundation\Request; |
8 | use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; | 8 | use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; |
9 | use Wallabag\CoreBundle\Entity\Entry; | 9 | use Wallabag\CoreBundle\Entity\Entry; |
10 | use Wallabag\CoreBundle\Entity\Tag; | ||
11 | 10 | ||
12 | /** | 11 | /** |
13 | * The try/catch can be removed once all formats will be implemented. | 12 | * The try/catch can be removed once all formats will be implemented. |