Loading module/Application/src/Application/Entity/Db/Etablissement.php +24 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,11 @@ class Etablissement implements StructureConcreteInterface, HistoriqueAwareInterf */ protected $estAssocie = false; /** * @var bool */ protected $estComue = false; /** * Etablissement constructor. */ Loading Loading @@ -194,6 +199,25 @@ class Etablissement implements StructureConcreteInterface, HistoriqueAwareInterf return $this; } /** * @return bool */ public function estComue() { return $this->estComue; } /** * @param bool $estComue * @return Etablissement */ public function setEstComue($estComue) { $this->estComue = $estComue; return $this; } /** * @return string */ Loading module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Etablissement.dcm.xml +1 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ <field name="domaine" type="string" length="50" column="DOMAINE" nullable="true"/> <field name="estMembre" type="boolean" column="EST_MEMBRE" nullable="false"/> <field name="estAssocie" type="boolean" column="EST_ASSOCIE" nullable="false"/> <field name="estComue" type="boolean" column="EST_COMUE"/> <one-to-many field="theses" target-entity="Application\Entity\Db\These" mapped-by="etablissement"/> <one-to-many field="doctorants" target-entity="Application\Entity\Db\Doctorant" mapped-by="etablissement"/> Loading module/Application/src/Application/Entity/Db/Parametre.php +0 −2 Original line number Diff line number Diff line Loading @@ -10,8 +10,6 @@ class Parametre // todo: cette valeur n'existe pas dans la table ! const APP_UTILISATEUR_ID = 'APP_UTILISATEUR_ID'; const ID__SOURCE_CODE_ETAB_COMMUNAUTE = 'SOURCE_CODE_ETAB_COMMUNAUTE'; /** * @var string */ Loading module/Application/src/Application/Service/Etablissement/EtablissementService.php +11 −12 Original line number Diff line number Diff line Loading @@ -7,14 +7,13 @@ use Application\Entity\Db\Repository\EtablissementRepository; use Application\Entity\Db\TypeStructure; use Application\Entity\Db\Utilisateur; use Application\Service\BaseService; use Application\Service\Parametre\ParametreServiceAwareTrait; use Application\SourceCodeStringHelperAwareTrait; use Doctrine\ORM\NonUniqueResultException; use Doctrine\ORM\OptimisticLockException; use UnicaenApp\Exception\RuntimeException; class EtablissementService extends BaseService { use ParametreServiceAwareTrait; use SourceCodeStringHelperAwareTrait; /** Loading @@ -33,20 +32,20 @@ class EtablissementService extends BaseService * * @return Etablissement|null */ public function fetchEtablissementCommunaute() public function fetchEtablissementComue() { $sourceCode = $this->parametreService->getSourceCodeEtablissementCommunaute(); if ($sourceCode === null) { return null; } $qb = $this->getRepository()->createQueryBuilder('e') ->addSelect('s') ->join('e.structure', 's') ->where('e.estComue = 1'); $etab = $this->getRepository()->findOneBySourceCode($sourceCode); if ($etab === null) { throw new RuntimeException( "Anomalie: aucun établissement trouvé avec le SOURCE_CODE '$sourceCode' spécifié pour l'établissement chapeau."); try { $comue = $qb->getQuery()->getOneOrNullResult(); } catch (NonUniqueResultException $e) { throw new RuntimeException("Anomalie: plusieurs établissements COMUE trouvés."); } return $etab; return $comue; } /** Loading module/Application/src/Application/Service/Etablissement/EtablissementServiceFactory.php +0 −7 Original line number Diff line number Diff line Loading @@ -2,7 +2,6 @@ namespace Application\Service\Etablissement; use Application\Service\Parametre\ParametreService; use Application\SourceCodeStringHelper; use Zend\ServiceManager\ServiceLocatorInterface; Loading @@ -16,13 +15,7 @@ class EtablissementServiceFactory */ public function __invoke(ServiceLocatorInterface $serviceLocator) { /** * @var ParametreService $parametreService */ $parametreService = $serviceLocator->get('ParametreService'); $service = new EtablissementService(); $service->setParametreService($parametreService); /** * @var SourceCodeStringHelper $sourceCodeHelper Loading Loading
module/Application/src/Application/Entity/Db/Etablissement.php +24 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,11 @@ class Etablissement implements StructureConcreteInterface, HistoriqueAwareInterf */ protected $estAssocie = false; /** * @var bool */ protected $estComue = false; /** * Etablissement constructor. */ Loading Loading @@ -194,6 +199,25 @@ class Etablissement implements StructureConcreteInterface, HistoriqueAwareInterf return $this; } /** * @return bool */ public function estComue() { return $this->estComue; } /** * @param bool $estComue * @return Etablissement */ public function setEstComue($estComue) { $this->estComue = $estComue; return $this; } /** * @return string */ Loading
module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Etablissement.dcm.xml +1 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ <field name="domaine" type="string" length="50" column="DOMAINE" nullable="true"/> <field name="estMembre" type="boolean" column="EST_MEMBRE" nullable="false"/> <field name="estAssocie" type="boolean" column="EST_ASSOCIE" nullable="false"/> <field name="estComue" type="boolean" column="EST_COMUE"/> <one-to-many field="theses" target-entity="Application\Entity\Db\These" mapped-by="etablissement"/> <one-to-many field="doctorants" target-entity="Application\Entity\Db\Doctorant" mapped-by="etablissement"/> Loading
module/Application/src/Application/Entity/Db/Parametre.php +0 −2 Original line number Diff line number Diff line Loading @@ -10,8 +10,6 @@ class Parametre // todo: cette valeur n'existe pas dans la table ! const APP_UTILISATEUR_ID = 'APP_UTILISATEUR_ID'; const ID__SOURCE_CODE_ETAB_COMMUNAUTE = 'SOURCE_CODE_ETAB_COMMUNAUTE'; /** * @var string */ Loading
module/Application/src/Application/Service/Etablissement/EtablissementService.php +11 −12 Original line number Diff line number Diff line Loading @@ -7,14 +7,13 @@ use Application\Entity\Db\Repository\EtablissementRepository; use Application\Entity\Db\TypeStructure; use Application\Entity\Db\Utilisateur; use Application\Service\BaseService; use Application\Service\Parametre\ParametreServiceAwareTrait; use Application\SourceCodeStringHelperAwareTrait; use Doctrine\ORM\NonUniqueResultException; use Doctrine\ORM\OptimisticLockException; use UnicaenApp\Exception\RuntimeException; class EtablissementService extends BaseService { use ParametreServiceAwareTrait; use SourceCodeStringHelperAwareTrait; /** Loading @@ -33,20 +32,20 @@ class EtablissementService extends BaseService * * @return Etablissement|null */ public function fetchEtablissementCommunaute() public function fetchEtablissementComue() { $sourceCode = $this->parametreService->getSourceCodeEtablissementCommunaute(); if ($sourceCode === null) { return null; } $qb = $this->getRepository()->createQueryBuilder('e') ->addSelect('s') ->join('e.structure', 's') ->where('e.estComue = 1'); $etab = $this->getRepository()->findOneBySourceCode($sourceCode); if ($etab === null) { throw new RuntimeException( "Anomalie: aucun établissement trouvé avec le SOURCE_CODE '$sourceCode' spécifié pour l'établissement chapeau."); try { $comue = $qb->getQuery()->getOneOrNullResult(); } catch (NonUniqueResultException $e) { throw new RuntimeException("Anomalie: plusieurs établissements COMUE trouvés."); } return $etab; return $comue; } /** Loading
module/Application/src/Application/Service/Etablissement/EtablissementServiceFactory.php +0 −7 Original line number Diff line number Diff line Loading @@ -2,7 +2,6 @@ namespace Application\Service\Etablissement; use Application\Service\Parametre\ParametreService; use Application\SourceCodeStringHelper; use Zend\ServiceManager\ServiceLocatorInterface; Loading @@ -16,13 +15,7 @@ class EtablissementServiceFactory */ public function __invoke(ServiceLocatorInterface $serviceLocator) { /** * @var ParametreService $parametreService */ $parametreService = $serviceLocator->get('ParametreService'); $service = new EtablissementService(); $service->setParametreService($parametreService); /** * @var SourceCodeStringHelper $sourceCodeHelper Loading