diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c1b01b288000329f7d5830e38bb8429bdc31b1a..8f6c3008f187907ce77cf6e1c56e720a29310e33 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ les nouveaux volumes horaires négatifs générés portent maintenant les mêmes * Les coordonnées bancaires peuvent être saisies même si elles sont hors zone SEPA (une case à cocher limite le contrôle) * L'export PDF des services est maintenant personnalisable. * Le pays "France" est détecté automatiquement. Il n'a donc plus besoin d'être identifié via administration/paramètres généraux. +* Amélioration de performances pour l'affichage des données personnelles ## Notes de mise à jour diff --git a/module/Application/src/Application/Service/PaysService.php b/module/Application/src/Application/Service/PaysService.php index 67e591f388e65b28049119ca8ced87780f0cfc6b..5a22152670fbc2c37ed32afd4d76fd107fa4c425 100755 --- a/module/Application/src/Application/Service/PaysService.php +++ b/module/Application/src/Application/Service/PaysService.php @@ -18,6 +18,10 @@ class PaysService extends AbstractEntityService use ParametresServiceAwareTrait; + /** + * @var array + */ + private $idsByLibelle; /** @@ -49,15 +53,19 @@ class PaysService extends AbstractEntityService */ public function getIdByLibelle(string $libelle) { - $sql = 'SELECT id FROM pays WHERE ose_divers.str_reduce(libelle_court) = :pays AND histo_destruction IS NULL'; + if (!isset($this->idsByLibelle[$libelle])) { + $sql = 'SELECT id FROM pays WHERE ose_divers.str_reduce(libelle_court) = :pays AND histo_destruction IS NULL'; - $res = $this->getEntityManager()->getConnection()->fetchAll($sql, ['pays' => Util::reduce($libelle)]); + $res = $this->getEntityManager()->getConnection()->fetchAll($sql, ['pays' => Util::reduce($libelle)]); - if (isset($res[0]['ID'])){ - return (int)$res[0]['ID']; + if (isset($res[0]['ID'])) { + $this->idsByLibelle[$libelle] = (int)$res[0]['ID']; + }else{ + $this->idsByLibelle[$libelle] = null; + } } - return null; + return $this->idsByLibelle[$libelle]; }