]> Raphaƫl G. Git Repositories - airbundle/blobdiff - Repository/EntityRepository.php
Update translations
[airbundle] / Repository / EntityRepository.php
index fb07c0b0537ff45cd5f319da2227f34140a4c687..38436491cf5f1a58ddfd476662547bfc78faea11 100644 (file)
@@ -67,6 +67,13 @@ class EntityRepository extends BaseEntityRepository {
         */
        protected array $languages = [];
 
+       /**
+        * The current locale
+        *
+        * @var string
+        */
+       protected string $locale;
+
        /**
         * Initializes a new LocationRepository instance
         *
@@ -76,14 +83,18 @@ class EntityRepository extends BaseEntityRepository {
         * @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) {
+       public function __construct(EntityManagerInterface $manager, ClassMetadata $class, RouterInterface $router, SluggerUtil $slugger, TranslatorInterface $translator, array $languages, string $locale) {
                //Call parent constructor
                parent::__construct($manager, $class);
 
                //Set languages
                $this->languages = $languages;
 
+               //Set locale
+               $this->locale = $locale;
+
                //Set router
                $this->router = $router;
 
@@ -101,6 +112,7 @@ class EntityRepository extends BaseEntityRepository {
                //XXX: this allow to make this code table name independent
                //XXX: remember to place longer prefix before shorter to avoid strange replacings
                $tables = [
+                       '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:Application' => $qs->getTableName($manager->getClassMetadata('RapsysAirBundle:Application'), $dp),
@@ -143,6 +155,9 @@ class EntityRepository extends BaseEntityRepository {
                        ':pnratio' => 1,
                        //XXX: tr_ratio diff over which considered at regular delay
                        ':trdiff' => 5,
+                       //Set locale
+                       //XXX: or $manager->getConnection()->quote($this->locale) ???
+                       ':locale' => $dp->quoteStringLiteral($this->locale),
                        //XXX: Set limit used to workaround mariadb subselect optimization
                        ':limit' => PHP_INT_MAX,
                        "\t" => '',