]> Raphaël G. Git Repositories - airbundle/commitdiff
Php 8.x constructor style
authorRaphaël Gertz <git@rapsys.eu>
Tue, 27 Feb 2024 15:38:49 +0000 (16:38 +0100)
committerRaphaël Gertz <git@rapsys.eu>
Tue, 27 Feb 2024 15:38:49 +0000 (16:38 +0100)
Add UserSubscription, GoogleCalendar and GoogleToken tables
Cleanup

Repository.php [moved from Repository/Repository.php with 80% similarity]

similarity index 80%
rename from Repository/Repository.php
rename to Repository.php
index fcf7d6af602ffd3473a47a82095d40fb66346a87..b2cc6509452d426b2d5d08224d14040c8e1cc15e 100644 (file)
@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
  * file that was distributed with this source code.
  */
 
-namespace Rapsys\AirBundle\Repository;
+namespace Rapsys\AirBundle;
 
 use Doctrine\ORM\EntityManagerInterface;
 use Doctrine\ORM\EntityRepository;
 
 use Doctrine\ORM\EntityManagerInterface;
 use Doctrine\ORM\EntityRepository;
@@ -25,20 +25,6 @@ use Rapsys\PackBundle\Util\SluggerUtil;
  * {@inheritdoc}
  */
 class Repository extends EntityRepository {
  * {@inheritdoc}
  */
 class Repository extends EntityRepository {
-       /**
-        * The RouterInterface instance
-        *
-        * @var RouterInterface
-        */
-       protected RouterInterface $router;
-
-       /**
-        * The SluggerUtil instance
-        *
-        * @var SluggerUtil
-        */
-       protected SluggerUtil $slugger;
-
        /**
         * The table keys array
         *
        /**
         * The table keys array
         *
@@ -53,27 +39,6 @@ class Repository extends EntityRepository {
         */
        protected array $tableValues;
 
         */
        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
         *
        /**
         * Initializes a new LocationRepository instance
         *
@@ -82,31 +47,16 @@ class Repository extends EntityRepository {
         * @param RouterInterface $router The router instance
         * @param SluggerUtil $slugger The SluggerUtil instance
         * @param TranslatorInterface $translator The TranslatorInterface instance
         * @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
         * @param string $locale The current locale
+        * @param array $languages The languages list
         */
         */
-       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, protected array $languages) {
                //Call parent constructor
                parent::__construct($manager, $class);
 
                //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
                //Get quote strategy
-               $qs = $manager->getConfiguration()->getQuoteStrategy();
-               $dp = $manager->getConnection()->getDatabasePlatform();
+               $qs = $this->manager->getConfiguration()->getQuoteStrategy();
+               $dp = $this->manager->getConnection()->getDatabasePlatform();
 
                //Set quoted table names
                //XXX: this allow to make this code table name independent
 
                //Set quoted table names
                //XXX: this allow to make this code table name independent
@@ -115,10 +65,13 @@ class Repository extends EntityRepository {
                        'RapsysAirBundle:UserDance' => $qs->getJoinTableName($manager->getClassMetadata('RapsysAirBundle:User')->getAssociationMapping('dances'), $manager->getClassMetadata('RapsysAirBundle:User'), $dp),
                        'RapsysAirBundle:UserGroup' => $qs->getJoinTableName($manager->getClassMetadata('RapsysAirBundle:User')->getAssociationMapping('groups'), $manager->getClassMetadata('RapsysAirBundle:User'), $dp),
                        'RapsysAirBundle:UserLocation' => $qs->getJoinTableName($manager->getClassMetadata('RapsysAirBundle:User')->getAssociationMapping('locations'), $manager->getClassMetadata('RapsysAirBundle:User'), $dp),
                        'RapsysAirBundle:UserDance' => $qs->getJoinTableName($manager->getClassMetadata('RapsysAirBundle:User')->getAssociationMapping('dances'), $manager->getClassMetadata('RapsysAirBundle:User'), $dp),
                        'RapsysAirBundle:UserGroup' => $qs->getJoinTableName($manager->getClassMetadata('RapsysAirBundle:User')->getAssociationMapping('groups'), $manager->getClassMetadata('RapsysAirBundle:User'), $dp),
                        'RapsysAirBundle:UserLocation' => $qs->getJoinTableName($manager->getClassMetadata('RapsysAirBundle:User')->getAssociationMapping('locations'), $manager->getClassMetadata('RapsysAirBundle:User'), $dp),
+                       'RapsysAirBundle:UserSubscription' => $qs->getJoinTableName($manager->getClassMetadata('RapsysAirBundle:User')->getAssociationMapping('subscriptions'), $manager->getClassMetadata('RapsysAirBundle:User'), $dp),
                        'RapsysAirBundle:Application' => $qs->getTableName($manager->getClassMetadata('RapsysAirBundle:Application'), $dp),
                        'RapsysAirBundle:Civility' => $qs->getTableName($manager->getClassMetadata('RapsysAirBundle:Civility'), $dp),
                        'RapsysAirBundle:Country' => $qs->getTableName($manager->getClassMetadata('RapsysAirBundle:Country'), $dp),
                        'RapsysAirBundle:Dance' => $qs->getTableName($manager->getClassMetadata('RapsysAirBundle:Dance'), $dp),
                        'RapsysAirBundle:Application' => $qs->getTableName($manager->getClassMetadata('RapsysAirBundle:Application'), $dp),
                        'RapsysAirBundle:Civility' => $qs->getTableName($manager->getClassMetadata('RapsysAirBundle:Civility'), $dp),
                        'RapsysAirBundle:Country' => $qs->getTableName($manager->getClassMetadata('RapsysAirBundle:Country'), $dp),
                        'RapsysAirBundle:Dance' => $qs->getTableName($manager->getClassMetadata('RapsysAirBundle:Dance'), $dp),
+                       'RapsysAirBundle:GoogleCalendar' => $qs->getTableName($manager->getClassMetadata('RapsysAirBundle:GoogleCalendar'), $dp),
+                       'RapsysAirBundle:GoogleToken' => $qs->getTableName($manager->getClassMetadata('RapsysAirBundle:GoogleToken'), $dp),
                        'RapsysAirBundle:Group' => $qs->getTableName($manager->getClassMetadata('RapsysAirBundle:Group'), $dp),
                        'RapsysAirBundle:Location' => $qs->getTableName($manager->getClassMetadata('RapsysAirBundle:Location'), $dp),
                        'RapsysAirBundle:Session' => $qs->getTableName($manager->getClassMetadata('RapsysAirBundle:Session'), $dp),
                        'RapsysAirBundle:Group' => $qs->getTableName($manager->getClassMetadata('RapsysAirBundle:Group'), $dp),
                        'RapsysAirBundle:Location' => $qs->getTableName($manager->getClassMetadata('RapsysAirBundle:Location'), $dp),
                        'RapsysAirBundle:Session' => $qs->getTableName($manager->getClassMetadata('RapsysAirBundle:Session'), $dp),