mirror of
https://github.com/wallabag/wallabag.git
synced 2024-11-30 04:51:01 +00:00
Fix getContainer in command
This commit is contained in:
parent
18c38dffc6
commit
03ce43d466
5 changed files with 7 additions and 8 deletions
|
@ -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()
|
||||
|
|
|
@ -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('<error>User "%s" not found.</error>', $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();
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue