diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Controller/ConfigController.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Controller/ConfigController.php | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index 89d27425..d4170d39 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php | |||
@@ -152,8 +152,7 @@ class ConfigController extends Controller | |||
152 | ], | 152 | ], |
153 | 'twofactor_auth' => $this->getParameter('twofactor_auth'), | 153 | 'twofactor_auth' => $this->getParameter('twofactor_auth'), |
154 | 'wallabag_url' => $this->getParameter('domain_name'), | 154 | 'wallabag_url' => $this->getParameter('domain_name'), |
155 | 'enabled_users' => $this->getDoctrine() | 155 | 'enabled_users' => $this->get('wallabag_user.user_repository') |
156 | ->getRepository('WallabagUserBundle:User') | ||
157 | ->getSumEnabledUsers(), | 156 | ->getSumEnabledUsers(), |
158 | ]); | 157 | ]); |
159 | } | 158 | } |
@@ -257,9 +256,7 @@ class ConfigController extends Controller | |||
257 | // manually remove tags to avoid orphan tag | 256 | // manually remove tags to avoid orphan tag |
258 | $this->removeAllTagsByUserId($this->getUser()->getId()); | 257 | $this->removeAllTagsByUserId($this->getUser()->getId()); |
259 | 258 | ||
260 | $this->getDoctrine() | 259 | $this->get('wallabag_core.entry_repository')->removeAllByUserId($this->getUser()->getId()); |
261 | ->getRepository('WallabagCoreBundle:Entry') | ||
262 | ->removeAllByUserId($this->getUser()->getId()); | ||
263 | break; | 260 | break; |
264 | case 'archived': | 261 | case 'archived': |
265 | if ($this->get('doctrine')->getConnection()->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform) { | 262 | if ($this->get('doctrine')->getConnection()->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform) { |
@@ -269,9 +266,7 @@ class ConfigController extends Controller | |||
269 | // manually remove tags to avoid orphan tag | 266 | // manually remove tags to avoid orphan tag |
270 | $this->removeTagsForArchivedByUserId($this->getUser()->getId()); | 267 | $this->removeTagsForArchivedByUserId($this->getUser()->getId()); |
271 | 268 | ||
272 | $this->getDoctrine() | 269 | $this->get('wallabag_core.entry_repository')->removeArchivedByUserId($this->getUser()->getId()); |
273 | ->getRepository('WallabagCoreBundle:Entry') | ||
274 | ->removeArchivedByUserId($this->getUser()->getId()); | ||
275 | break; | 270 | break; |
276 | } | 271 | } |
277 | 272 | ||
@@ -295,8 +290,7 @@ class ConfigController extends Controller | |||
295 | return; | 290 | return; |
296 | } | 291 | } |
297 | 292 | ||
298 | $this->getDoctrine() | 293 | $this->get('wallabag_core.entry_repository') |
299 | ->getRepository('WallabagCoreBundle:Entry') | ||
300 | ->removeTags($userId, $tags); | 294 | ->removeTags($userId, $tags); |
301 | 295 | ||
302 | // cleanup orphan tags | 296 | // cleanup orphan tags |
@@ -318,7 +312,7 @@ class ConfigController extends Controller | |||
318 | */ | 312 | */ |
319 | private function removeAllTagsByUserId($userId) | 313 | private function removeAllTagsByUserId($userId) |
320 | { | 314 | { |
321 | $tags = $this->getDoctrine()->getRepository('WallabagCoreBundle:Tag')->findAllTags($userId); | 315 | $tags = $this->get('wallabag_core.tag_repository')->findAllTags($userId); |
322 | $this->removeAllTagsByStatusAndUserId($tags, $userId); | 316 | $this->removeAllTagsByStatusAndUserId($tags, $userId); |
323 | } | 317 | } |
324 | 318 | ||
@@ -329,7 +323,7 @@ class ConfigController extends Controller | |||
329 | */ | 323 | */ |
330 | private function removeTagsForArchivedByUserId($userId) | 324 | private function removeTagsForArchivedByUserId($userId) |
331 | { | 325 | { |
332 | $tags = $this->getDoctrine()->getRepository('WallabagCoreBundle:Tag')->findForArchivedArticlesByUser($userId); | 326 | $tags = $this->get('wallabag_core.tag_repository')->findForArchivedArticlesByUser($userId); |
333 | $this->removeAllTagsByStatusAndUserId($tags, $userId); | 327 | $this->removeAllTagsByStatusAndUserId($tags, $userId); |
334 | } | 328 | } |
335 | 329 | ||
@@ -393,8 +387,7 @@ class ConfigController extends Controller | |||
393 | */ | 387 | */ |
394 | public function deleteAccountAction(Request $request) | 388 | public function deleteAccountAction(Request $request) |
395 | { | 389 | { |
396 | $enabledUsers = $this->getDoctrine() | 390 | $enabledUsers = $this->get('wallabag_user.user_repository') |
397 | ->getRepository('WallabagUserBundle:User') | ||
398 | ->getSumEnabledUsers(); | 391 | ->getSumEnabledUsers(); |
399 | 392 | ||
400 | if ($enabledUsers <= 1) { | 393 | if ($enabledUsers <= 1) { |