Use FQCN as service name for UserRepository

This commit is contained in:
Yassine Guedidi 2022-04-24 16:09:34 +02:00
parent 97a4e826b5
commit ff9f719ec5
11 changed files with 39 additions and 32 deletions

View file

@ -13,7 +13,7 @@ services:
public: true
wallabag_user.user_repository.test:
alias: wallabag_user.user_repository
alias: Wallabag\UserBundle\Repository\UserRepository
public: true
filesystem_cache:

View file

@ -10,6 +10,7 @@ use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Wallabag\CoreBundle\Entity\Entry;
use Wallabag\UserBundle\Entity\User;
use Wallabag\UserBundle\Repository\UserRepository;
class CleanDuplicatesCommand extends ContainerAwareCommand
{
@ -49,7 +50,7 @@ class CleanDuplicatesCommand extends ContainerAwareCommand
$this->io->success('Finished cleaning.');
} else {
$users = $this->getContainer()->get('wallabag_user.user_repository')->findAll();
$users = $this->getContainer()->get(UserRepository::class)->findAll();
$this->io->text(sprintf('Cleaning through <info>%d</info> user accounts', \count($users)));
@ -109,6 +110,6 @@ class CleanDuplicatesCommand extends ContainerAwareCommand
*/
private function getUser($username)
{
return $this->getContainer()->get('wallabag_user.user_repository')->findOneByUserName($username);
return $this->getContainer()->get(UserRepository::class)->findOneByUserName($username);
}
}

View file

@ -8,6 +8,7 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Wallabag\UserBundle\Repository\UserRepository;
class ExportCommand extends ContainerAwareCommand
{
@ -35,7 +36,7 @@ class ExportCommand extends ContainerAwareCommand
$io = new SymfonyStyle($input, $output);
try {
$user = $this->getContainer()->get('wallabag_user.user_repository')->findOneByUserName($input->getArgument('username'));
$user = $this->getContainer()->get(UserRepository::class)->findOneByUserName($input->getArgument('username'));
} catch (NoResultException $e) {
$io->error(sprintf('User "%s" not found.', $input->getArgument('username')));

View file

@ -8,6 +8,7 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Wallabag\UserBundle\Repository\UserRepository;
class ListUserCommand extends ContainerAwareCommand
{
@ -26,13 +27,13 @@ class ListUserCommand extends ContainerAwareCommand
{
$io = new SymfonyStyle($input, $output);
$users = $this->getContainer()->get('wallabag_user.user_repository')
$users = $this->getContainer()->get(UserRepository::class)
->getQueryBuilderForSearch($input->getArgument('search'))
->setMaxResults($input->getOption('limit'))
->getQuery()
->getResult();
$nbUsers = $this->getContainer()->get('wallabag_user.user_repository')
$nbUsers = $this->getContainer()->get(UserRepository::class)
->getSumUsers();
$rows = [];

View file

@ -9,6 +9,7 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Wallabag\CoreBundle\Event\EntrySavedEvent;
use Wallabag\UserBundle\Repository\UserRepository;
class ReloadEntryCommand extends ContainerAwareCommand
{
@ -30,7 +31,7 @@ class ReloadEntryCommand extends ContainerAwareCommand
if ($username = $input->getArgument('username')) {
try {
$userId = $this->getContainer()
->get('wallabag_user.user_repository')
->get(UserRepository::class)
->findOneByUserName($username)
->getId();
} catch (NoResultException $e) {

View file

@ -9,6 +9,7 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Wallabag\UserBundle\Entity\User;
use Wallabag\UserBundle\Repository\UserRepository;
class ShowUserCommand extends ContainerAwareCommand
{
@ -68,6 +69,6 @@ class ShowUserCommand extends ContainerAwareCommand
*/
private function getUser($username)
{
return $this->getContainer()->get('wallabag_user.user_repository')->findOneByUserName($username);
return $this->getContainer()->get(UserRepository::class)->findOneByUserName($username);
}
}

View file

@ -8,6 +8,7 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Wallabag\UserBundle\Repository\UserRepository;
class TagAllCommand extends ContainerAwareCommand
{
@ -63,7 +64,7 @@ class TagAllCommand extends ContainerAwareCommand
*/
private function getUser($username)
{
return $this->getContainer()->get('wallabag_user.user_repository')->findOneByUserName($username);
return $this->getContainer()->get(UserRepository::class)->findOneByUserName($username);
}
private function getDoctrine()

View file

@ -25,6 +25,7 @@ use Wallabag\CoreBundle\Form\Type\TaggingRuleImportType;
use Wallabag\CoreBundle\Form\Type\TaggingRuleType;
use Wallabag\CoreBundle\Form\Type\UserInformationType;
use Wallabag\CoreBundle\Tools\Utils;
use Wallabag\UserBundle\Repository\UserRepository;
class ConfigController extends Controller
{
@ -236,7 +237,7 @@ class ConfigController extends Controller
],
'twofactor_auth' => $this->getParameter('twofactor_auth'),
'wallabag_url' => $this->getParameter('domain_name'),
'enabled_users' => $this->get('wallabag_user.user_repository')->getSumEnabledUsers(),
'enabled_users' => $this->get(UserRepository::class)->getSumEnabledUsers(),
]);
}
@ -594,7 +595,7 @@ class ConfigController extends Controller
*/
public function deleteAccountAction(Request $request)
{
$enabledUsers = $this->get('wallabag_user.user_repository')
$enabledUsers = $this->get(UserRepository::class)
->getSumEnabledUsers();
if ($enabledUsers <= 1) {

View file

@ -4,7 +4,7 @@ services:
class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer
arguments:
- "@doctrine.orm.entity_manager"
- "@wallabag_user.user_repository"
- '@Wallabag\UserBundle\Repository\UserRepository'
- "@wallabag_import.pocket.import"
- "@event_dispatcher"
- "@logger"
@ -12,7 +12,7 @@ services:
class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer
arguments:
- "@doctrine.orm.entity_manager"
- "@wallabag_user.user_repository"
- '@Wallabag\UserBundle\Repository\UserRepository'
- "@wallabag_import.readability.import"
- "@event_dispatcher"
- "@logger"
@ -20,7 +20,7 @@ services:
class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer
arguments:
- "@doctrine.orm.entity_manager"
- "@wallabag_user.user_repository"
- '@Wallabag\UserBundle\Repository\UserRepository'
- "@wallabag_import.instapaper.import"
- "@event_dispatcher"
- "@logger"
@ -28,7 +28,7 @@ services:
class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer
arguments:
- "@doctrine.orm.entity_manager"
- "@wallabag_user.user_repository"
- '@Wallabag\UserBundle\Repository\UserRepository'
- "@wallabag_import.pinboard.import"
- "@event_dispatcher"
- "@logger"
@ -36,7 +36,7 @@ services:
class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer
arguments:
- "@doctrine.orm.entity_manager"
- "@wallabag_user.user_repository"
- '@Wallabag\UserBundle\Repository\UserRepository'
- "@wallabag_import.delicious.import"
- "@event_dispatcher"
- "@logger"
@ -44,7 +44,7 @@ services:
class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer
arguments:
- "@doctrine.orm.entity_manager"
- "@wallabag_user.user_repository"
- '@Wallabag\UserBundle\Repository\UserRepository'
- "@wallabag_import.wallabag_v1.import"
- "@event_dispatcher"
- "@logger"
@ -52,7 +52,7 @@ services:
class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer
arguments:
- "@doctrine.orm.entity_manager"
- "@wallabag_user.user_repository"
- '@Wallabag\UserBundle\Repository\UserRepository'
- "@wallabag_import.wallabag_v2.import"
- "@event_dispatcher"
- "@logger"
@ -60,7 +60,7 @@ services:
class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer
arguments:
- "@doctrine.orm.entity_manager"
- "@wallabag_user.user_repository"
- '@Wallabag\UserBundle\Repository\UserRepository'
- "@wallabag_import.elcurator.import"
- "@event_dispatcher"
- "@logger"
@ -68,7 +68,7 @@ services:
class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer
arguments:
- "@doctrine.orm.entity_manager"
- "@wallabag_user.user_repository"
- '@Wallabag\UserBundle\Repository\UserRepository'
- "@wallabag_import.firefox.import"
- "@event_dispatcher"
- "@logger"
@ -76,7 +76,7 @@ services:
class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer
arguments:
- "@doctrine.orm.entity_manager"
- "@wallabag_user.user_repository"
- '@Wallabag\UserBundle\Repository\UserRepository'
- "@wallabag_import.chrome.import"
- "@event_dispatcher"
- "@logger"

View file

@ -16,7 +16,7 @@ services:
class: Wallabag\ImportBundle\Consumer\RedisEntryConsumer
arguments:
- "@doctrine.orm.entity_manager"
- "@wallabag_user.user_repository"
- '@Wallabag\UserBundle\Repository\UserRepository'
- "@wallabag_import.readability.import"
- "@event_dispatcher"
- "@logger"
@ -37,7 +37,7 @@ services:
class: Wallabag\ImportBundle\Consumer\RedisEntryConsumer
arguments:
- "@doctrine.orm.entity_manager"
- "@wallabag_user.user_repository"
- '@Wallabag\UserBundle\Repository\UserRepository'
- "@wallabag_import.instapaper.import"
- "@event_dispatcher"
- "@logger"
@ -58,7 +58,7 @@ services:
class: Wallabag\ImportBundle\Consumer\RedisEntryConsumer
arguments:
- "@doctrine.orm.entity_manager"
- "@wallabag_user.user_repository"
- '@Wallabag\UserBundle\Repository\UserRepository'
- "@wallabag_import.pinboard.import"
- "@event_dispatcher"
- "@logger"
@ -79,7 +79,7 @@ services:
class: Wallabag\ImportBundle\Consumer\RedisEntryConsumer
arguments:
- "@doctrine.orm.entity_manager"
- "@wallabag_user.user_repository"
- '@Wallabag\UserBundle\Repository\UserRepository'
- "@wallabag_import.delicious.import"
- "@event_dispatcher"
- "@logger"
@ -100,7 +100,7 @@ services:
class: Wallabag\ImportBundle\Consumer\RedisEntryConsumer
arguments:
- "@doctrine.orm.entity_manager"
- "@wallabag_user.user_repository"
- '@Wallabag\UserBundle\Repository\UserRepository'
- "@wallabag_import.pocket.import"
- "@event_dispatcher"
- "@logger"
@ -121,7 +121,7 @@ services:
class: Wallabag\ImportBundle\Consumer\RedisEntryConsumer
arguments:
- "@doctrine.orm.entity_manager"
- "@wallabag_user.user_repository"
- '@Wallabag\UserBundle\Repository\UserRepository'
- "@wallabag_import.wallabag_v1.import"
- "@event_dispatcher"
- "@logger"
@ -142,7 +142,7 @@ services:
class: Wallabag\ImportBundle\Consumer\RedisEntryConsumer
arguments:
- "@doctrine.orm.entity_manager"
- "@wallabag_user.user_repository"
- '@Wallabag\UserBundle\Repository\UserRepository'
- "@wallabag_import.wallabag_v2.import"
- "@event_dispatcher"
- "@logger"
@ -163,7 +163,7 @@ services:
class: Wallabag\ImportBundle\Consumer\RedisEntryConsumer
arguments:
- "@doctrine.orm.entity_manager"
- "@wallabag_user.user_repository"
- '@Wallabag\UserBundle\Repository\UserRepository'
- "@wallabag_import.elcurator.import"
- "@event_dispatcher"
- "@logger"
@ -184,7 +184,7 @@ services:
class: Wallabag\ImportBundle\Consumer\RedisEntryConsumer
arguments:
- "@doctrine.orm.entity_manager"
- "@wallabag_user.user_repository"
- '@Wallabag\UserBundle\Repository\UserRepository'
- "@wallabag_import.firefox.import"
- "@event_dispatcher"
- "@logger"
@ -205,7 +205,7 @@ services:
class: Wallabag\ImportBundle\Consumer\RedisEntryConsumer
arguments:
- "@doctrine.orm.entity_manager"
- "@wallabag_user.user_repository"
- '@Wallabag\UserBundle\Repository\UserRepository'
- "@wallabag_import.chrome.import"
- "@event_dispatcher"
- "@logger"

View file

@ -23,7 +23,7 @@ services:
tags:
- { name: kernel.event_subscriber }
wallabag_user.user_repository:
Wallabag\UserBundle\Repository\UserRepository:
class: Wallabag\UserBundle\Repository\UserRepository
factory: [ "@doctrine.orm.default_entity_manager", getRepository ]
arguments: