From e57fd4e1f21e9a7b44e7d9db078e261ddc0450cf Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Gertz?= Date: Tue, 27 Feb 2024 14:18:57 +0100 Subject: [PATCH 1/1] Rename Repository/EntityRepository in Repository --- .../EntityRepository.php => Repository.php | 61 ++----------------- Repository/UserRepository.php | 4 +- 2 files changed, 8 insertions(+), 57 deletions(-) rename Repository/EntityRepository.php => Repository.php (71%) diff --git a/Repository/EntityRepository.php b/Repository.php similarity index 71% rename from Repository/EntityRepository.php rename to Repository.php index db1921c..b21b0ca 100644 --- a/Repository/EntityRepository.php +++ b/Repository.php @@ -9,10 +9,10 @@ * file that was distributed with this source code. */ -namespace Rapsys\UserBundle\Repository; +namespace Rapsys\UserBundle; use Doctrine\ORM\EntityManagerInterface; -use Doctrine\ORM\EntityRepository as BaseEntityRepository; +use Doctrine\ORM\EntityRepository; use Doctrine\ORM\Mapping\ClassMetadata; use Symfony\Component\Routing\RouterInterface; use Symfony\Contracts\Translation\TranslatorInterface; @@ -20,25 +20,11 @@ use Symfony\Contracts\Translation\TranslatorInterface; use Rapsys\PackBundle\Util\SluggerUtil; /** - * EntityRepository + * Repository * * {@inheritdoc} */ -class EntityRepository extends BaseEntityRepository { - /** - * The RouterInterface instance - * - * @var RouterInterface - */ - protected RouterInterface $router; - - /** - * The SluggerUtil instance - * - * @var SluggerUtil - */ - protected SluggerUtil $slugger; - +class Repository extends EntityRepository { /** * The table keys array * @@ -53,27 +39,6 @@ class EntityRepository extends BaseEntityRepository { */ protected array $tableValues; - /** - * The TranslatorInterface instance - * - * @var TranslatorInterface - */ - protected TranslatorInterface $translator; - - /** - * The list of languages - * - * @var string[] - */ - protected array $languages = []; - - /** - * The current locale - * - * @var string - */ - protected string $locale; - /** * Initializes a new LocationRepository instance * @@ -82,28 +47,12 @@ class EntityRepository extends BaseEntityRepository { * @param RouterInterface $router The router instance * @param SluggerUtil $slugger The SluggerUtil instance * @param TranslatorInterface $translator The TranslatorInterface instance - * @param array $languages The languages list * @param string $locale The current locale */ - public function __construct(EntityManagerInterface $manager, ClassMetadata $class, RouterInterface $router, SluggerUtil $slugger, TranslatorInterface $translator, array $languages, string $locale) { + public function __construct(protected EntityManagerInterface $manager, protected ClassMetadata $class, protected RouterInterface $router, protected SluggerUtil $slugger, protected TranslatorInterface $translator, protected string $locale) { //Call parent constructor parent::__construct($manager, $class); - //Set languages - $this->languages = $languages; - - //Set locale - $this->locale = $locale; - - //Set router - $this->router = $router; - - //Set slugger - $this->slugger = $slugger; - - //Set translator - $this->translator = $translator; - //Get quote strategy $qs = $manager->getConfiguration()->getQuoteStrategy(); $dp = $manager->getConnection()->getDatabasePlatform(); diff --git a/Repository/UserRepository.php b/Repository/UserRepository.php index da5952f..db4d84e 100644 --- a/Repository/UserRepository.php +++ b/Repository/UserRepository.php @@ -16,10 +16,12 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; use Symfony\Component\Security\Core\User\PasswordUpgraderInterface; +use Rapsys\UserBundle\Repository; + /** * UserRepository */ -class UserRepository extends EntityRepository implements PasswordUpgraderInterface { +class UserRepository extends Repository implements PasswordUpgraderInterface { /** * Find user count as int * -- 2.41.1