Loading config/example.phpdeleted 100644 → 0 +0 −36 Original line number Diff line number Diff line <?php namespace UnicaenParametre; use UnicaenPrivilege\Guard\PrivilegeController; use Laminas\Router\Http\Literal; use Laminas\Router\Http\Segment; return [ 'bjyauthorize' => [ 'guards' => [ PrivilegeController::class => [ ], ], ], 'router' => [ 'routes' => [ ], ], 'service_manager' => [ 'factories' => [], ], 'controllers' => [ 'factories' => [], ], 'form_elements' => [ 'factories' => [], ], 'hydrators' => [ 'factories' => [], ] ]; No newline at end of file src/UnicaenParametre/Entity/Db/Mapping/UnicaenParametre.Entity.Db.Categorie.dcm.xml +4 −4 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8" ?> <doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> <doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping https://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> <entity name="UnicaenParametre\Entity\Db\Categorie" table="unicaen_parametre_categorie"> <id name="id" column="id" type="integer"> <generator strategy="IDENTITY"/> </id> <field name="code" column="code" type="string" length="1024" nullable="false" /> <field name="libelle" column="libelle" type="string" length="1024" nullable="false" /> <field name="description" column="description" type="string" length="4096" nullable="true" /> <field name="code" column="code" type="string" length="1024" /> <field name="libelle" column="libelle" type="string" length="1024" /> <field name="description" column="description" type="text" nullable="true" /> <field name="ordre" column="ordre" type="integer" nullable="true" /> </entity> Loading src/UnicaenParametre/Entity/Db/Mapping/UnicaenParametre.Entity.Db.Parametre.dcm.xml +3 −3 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8" ?> <doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> <doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping https://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> <entity name="UnicaenParametre\Entity\Db\Parametre" table="unicaen_parametre_parametre"> <id name="id" column="id" type="integer"> Loading @@ -10,8 +10,8 @@ <join-column name="categorie_id" referenced-column-name="id"/> </many-to-one> <field name="code" column="code" type="string" length="1024" nullable="false" /> <field name="libelle" column="libelle" type="string" length="1024" nullable="false" /> <field name="code" column="code" type="string" length="1024" /> <field name="libelle" column="libelle" type="string" length="1024" /> <field name="description" column="description" type="string" length="4096" nullable="true" /> <field name="valeurs_possibles" column="valeurs_possibles" type="string" length="4096" nullable="true" /> <field name="valeur" column="valeur" type="string" length="4096" nullable="true" /> Loading src/UnicaenParametre/Service/Categorie/CategorieService.php +6 −51 Original line number Diff line number Diff line Loading @@ -3,7 +3,6 @@ namespace UnicaenParametre\Service\Categorie; use Doctrine\ORM\NonUniqueResultException; use Doctrine\ORM\ORMException; use Doctrine\ORM\QueryBuilder; use DoctrineModule\Persistence\ProvidesObjectManager; use Laminas\Mvc\Controller\AbstractActionController; Loading @@ -16,66 +15,35 @@ class CategorieService /** GESTION ENTITY ************************************************************************************************/ /** * @param Categorie $categorie * @return Categorie */ public function create(Categorie $categorie): Categorie { try { $this->getObjectManager()->persist($categorie); $this->getObjectManager()->flush($categorie); } catch (ORMException $e) { throw new RuntimeException("Une erreur s'est produite lors de l'enregistrement en base.", 0, $e); } return $categorie; } /** * @param Categorie $categorie * @return Categorie */ public function update(Categorie $categorie): Categorie { try { $this->getObjectManager()->flush($categorie); } catch (ORMException $e) { throw new RuntimeException("Une erreur s'est produite lors de la mise à jour en base.", 0, $e); } return $categorie; } /** * @param Categorie $categorie * @return Categorie */ public function delete(Categorie $categorie): Categorie { try { $this->getObjectManager()->remove($categorie); $this->getObjectManager()->flush($categorie); } catch (ORMException $e) { throw new RuntimeException("Une erreur s'est produite lors de la suppression en base.", 0, $e); } return $categorie; } /** REQUETAGE *****************************************************************************************************/ /** * @return QueryBuilder */ public function createQueryBuilder(): QueryBuilder { $qb = $this->getObjectManager()->getRepository(Categorie::class)->createQueryBuilder('categorie'); return $qb; } /** * @param string $champ * @param string $ordre * @return Categorie[] */ /** @return Categorie[] */ public function getCategories(string $champ = "ordre", string $ordre = "ASC"): array { $qb = $this->createQueryBuilder() Loading @@ -100,10 +68,6 @@ class CategorieService return $array; } /** * @param int|null $id * @return Categorie|null */ public function getCategorie(?int $id): ?Categorie { $qb = $this->createQueryBuilder() Loading @@ -117,10 +81,6 @@ class CategorieService return $result; } /** * @param string $code * @return Categorie|null */ public function getCategoriebyCode(string $code): ?Categorie { $qb = $this->createQueryBuilder() Loading @@ -134,11 +94,6 @@ class CategorieService return $result; } /** * @param AbstractActionController $controller * @param string $param * @return Categorie|null */ public function getRequestedCategorie(AbstractActionController $controller, string $param = 'categorie'): ?Categorie { $id = $controller->params()->fromRoute($param); Loading src/UnicaenParametre/Service/Parametre/ParametreService.php +8 −59 Original line number Diff line number Diff line Loading @@ -3,7 +3,6 @@ namespace UnicaenParametre\Service\Parametre; use Doctrine\ORM\NonUniqueResultException; use Doctrine\ORM\ORMException; use Doctrine\ORM\QueryBuilder; use DoctrineModule\Persistence\ProvidesObjectManager; use UnicaenParametre\Exception\ParametreMalTypeException; Loading @@ -19,55 +18,28 @@ class ParametreService /** GESTION ENTITY ************************************************************************************************/ /** * @param Parametre $parametre * @return Parametre */ public function create(Parametre $parametre): Parametre { try { $this->getObjectManager()->persist($parametre); $this->getObjectManager()->flush($parametre); } catch (ORMException $e) { throw new RuntimeException("Une erreur s'est produite lors de l'enregistrement en base.", 0, $e); } return $parametre; } /** * @param Parametre $parametre * @return Parametre */ public function update(Parametre $parametre): Parametre { try { $this->getObjectManager()->flush($parametre); } catch (ORMException $e) { throw new RuntimeException("Une erreur s'est produite lors de la mise à jour en base.", 0, $e); } return $parametre; } /** * @param Parametre $parametre * @return Parametre */ public function delete(Parametre $parametre): Parametre { try { $this->getObjectManager()->remove($parametre); $this->getObjectManager()->flush($parametre); } catch (ORMException $e) { throw new RuntimeException("Une erreur s'est produite lors de la suppression en base.", 0, $e); } return $parametre; } /** REQUETAGE *****************************************************************************************************/ /** * @return QueryBuilder */ public function createQueryBuilder(): QueryBuilder { $qb = $this->getObjectManager()->getRepository(Parametre::class)->createQueryBuilder('parametre') Loading @@ -75,11 +47,7 @@ class ParametreService return $qb; } /** * @param string $champ * @param string $ordre * @return Parametre[] */ /** @return Parametre[] */ public function getParametres(string $champ = 'ordre', string $ordre = 'ASC'): array { $qb = $this->createQueryBuilder() Loading @@ -88,12 +56,7 @@ class ParametreService return $result; } /** * @param Categorie $categorie * @param string $champ * @param string $ordre * @return Parametre[] */ /** @return Parametre[] */ public function getParametresByCategorie(Categorie $categorie, string $champ = 'ordre', string $ordre = 'ASC'): array { $qb = $this->createQueryBuilder() Loading @@ -104,10 +67,6 @@ class ParametreService return $result; } /** * @param int $id * @return Parametre|null */ public function getParametre(int $id): ?Parametre { $qb = $this->createQueryBuilder() Loading @@ -121,11 +80,6 @@ class ParametreService return $result; } /** * @param string $categorieCode * @param string $parametreCode * @return Parametre|null */ public function getParametreByCode(string $categorieCode, string $parametreCode): ?Parametre { $qb = $this->createQueryBuilder() Loading @@ -142,11 +96,6 @@ class ParametreService return $result; } /** * @param AbstractActionController $controller * @param string $param * @return Parametre */ public function getRequestedParametre(AbstractActionController $controller, string $param = 'parametre') : ?Parametre { $id = $controller->params()->fromRoute($param); Loading @@ -161,7 +110,7 @@ class ParametreService * @throws ParametreNotFoundException * @throws ParametreMalTypeException */ public function getValeurForParametre(string $categorieCode, string $parametreCode) public function getValeurForParametre(string $categorieCode, string $parametreCode): string|int|bool|null { $parametre = $this->getParametreByCode($categorieCode, $parametreCode); if ($parametre === null) { Loading Loading
config/example.phpdeleted 100644 → 0 +0 −36 Original line number Diff line number Diff line <?php namespace UnicaenParametre; use UnicaenPrivilege\Guard\PrivilegeController; use Laminas\Router\Http\Literal; use Laminas\Router\Http\Segment; return [ 'bjyauthorize' => [ 'guards' => [ PrivilegeController::class => [ ], ], ], 'router' => [ 'routes' => [ ], ], 'service_manager' => [ 'factories' => [], ], 'controllers' => [ 'factories' => [], ], 'form_elements' => [ 'factories' => [], ], 'hydrators' => [ 'factories' => [], ] ]; No newline at end of file
src/UnicaenParametre/Entity/Db/Mapping/UnicaenParametre.Entity.Db.Categorie.dcm.xml +4 −4 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8" ?> <doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> <doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping https://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> <entity name="UnicaenParametre\Entity\Db\Categorie" table="unicaen_parametre_categorie"> <id name="id" column="id" type="integer"> <generator strategy="IDENTITY"/> </id> <field name="code" column="code" type="string" length="1024" nullable="false" /> <field name="libelle" column="libelle" type="string" length="1024" nullable="false" /> <field name="description" column="description" type="string" length="4096" nullable="true" /> <field name="code" column="code" type="string" length="1024" /> <field name="libelle" column="libelle" type="string" length="1024" /> <field name="description" column="description" type="text" nullable="true" /> <field name="ordre" column="ordre" type="integer" nullable="true" /> </entity> Loading
src/UnicaenParametre/Entity/Db/Mapping/UnicaenParametre.Entity.Db.Parametre.dcm.xml +3 −3 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8" ?> <doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> <doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping https://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> <entity name="UnicaenParametre\Entity\Db\Parametre" table="unicaen_parametre_parametre"> <id name="id" column="id" type="integer"> Loading @@ -10,8 +10,8 @@ <join-column name="categorie_id" referenced-column-name="id"/> </many-to-one> <field name="code" column="code" type="string" length="1024" nullable="false" /> <field name="libelle" column="libelle" type="string" length="1024" nullable="false" /> <field name="code" column="code" type="string" length="1024" /> <field name="libelle" column="libelle" type="string" length="1024" /> <field name="description" column="description" type="string" length="4096" nullable="true" /> <field name="valeurs_possibles" column="valeurs_possibles" type="string" length="4096" nullable="true" /> <field name="valeur" column="valeur" type="string" length="4096" nullable="true" /> Loading
src/UnicaenParametre/Service/Categorie/CategorieService.php +6 −51 Original line number Diff line number Diff line Loading @@ -3,7 +3,6 @@ namespace UnicaenParametre\Service\Categorie; use Doctrine\ORM\NonUniqueResultException; use Doctrine\ORM\ORMException; use Doctrine\ORM\QueryBuilder; use DoctrineModule\Persistence\ProvidesObjectManager; use Laminas\Mvc\Controller\AbstractActionController; Loading @@ -16,66 +15,35 @@ class CategorieService /** GESTION ENTITY ************************************************************************************************/ /** * @param Categorie $categorie * @return Categorie */ public function create(Categorie $categorie): Categorie { try { $this->getObjectManager()->persist($categorie); $this->getObjectManager()->flush($categorie); } catch (ORMException $e) { throw new RuntimeException("Une erreur s'est produite lors de l'enregistrement en base.", 0, $e); } return $categorie; } /** * @param Categorie $categorie * @return Categorie */ public function update(Categorie $categorie): Categorie { try { $this->getObjectManager()->flush($categorie); } catch (ORMException $e) { throw new RuntimeException("Une erreur s'est produite lors de la mise à jour en base.", 0, $e); } return $categorie; } /** * @param Categorie $categorie * @return Categorie */ public function delete(Categorie $categorie): Categorie { try { $this->getObjectManager()->remove($categorie); $this->getObjectManager()->flush($categorie); } catch (ORMException $e) { throw new RuntimeException("Une erreur s'est produite lors de la suppression en base.", 0, $e); } return $categorie; } /** REQUETAGE *****************************************************************************************************/ /** * @return QueryBuilder */ public function createQueryBuilder(): QueryBuilder { $qb = $this->getObjectManager()->getRepository(Categorie::class)->createQueryBuilder('categorie'); return $qb; } /** * @param string $champ * @param string $ordre * @return Categorie[] */ /** @return Categorie[] */ public function getCategories(string $champ = "ordre", string $ordre = "ASC"): array { $qb = $this->createQueryBuilder() Loading @@ -100,10 +68,6 @@ class CategorieService return $array; } /** * @param int|null $id * @return Categorie|null */ public function getCategorie(?int $id): ?Categorie { $qb = $this->createQueryBuilder() Loading @@ -117,10 +81,6 @@ class CategorieService return $result; } /** * @param string $code * @return Categorie|null */ public function getCategoriebyCode(string $code): ?Categorie { $qb = $this->createQueryBuilder() Loading @@ -134,11 +94,6 @@ class CategorieService return $result; } /** * @param AbstractActionController $controller * @param string $param * @return Categorie|null */ public function getRequestedCategorie(AbstractActionController $controller, string $param = 'categorie'): ?Categorie { $id = $controller->params()->fromRoute($param); Loading
src/UnicaenParametre/Service/Parametre/ParametreService.php +8 −59 Original line number Diff line number Diff line Loading @@ -3,7 +3,6 @@ namespace UnicaenParametre\Service\Parametre; use Doctrine\ORM\NonUniqueResultException; use Doctrine\ORM\ORMException; use Doctrine\ORM\QueryBuilder; use DoctrineModule\Persistence\ProvidesObjectManager; use UnicaenParametre\Exception\ParametreMalTypeException; Loading @@ -19,55 +18,28 @@ class ParametreService /** GESTION ENTITY ************************************************************************************************/ /** * @param Parametre $parametre * @return Parametre */ public function create(Parametre $parametre): Parametre { try { $this->getObjectManager()->persist($parametre); $this->getObjectManager()->flush($parametre); } catch (ORMException $e) { throw new RuntimeException("Une erreur s'est produite lors de l'enregistrement en base.", 0, $e); } return $parametre; } /** * @param Parametre $parametre * @return Parametre */ public function update(Parametre $parametre): Parametre { try { $this->getObjectManager()->flush($parametre); } catch (ORMException $e) { throw new RuntimeException("Une erreur s'est produite lors de la mise à jour en base.", 0, $e); } return $parametre; } /** * @param Parametre $parametre * @return Parametre */ public function delete(Parametre $parametre): Parametre { try { $this->getObjectManager()->remove($parametre); $this->getObjectManager()->flush($parametre); } catch (ORMException $e) { throw new RuntimeException("Une erreur s'est produite lors de la suppression en base.", 0, $e); } return $parametre; } /** REQUETAGE *****************************************************************************************************/ /** * @return QueryBuilder */ public function createQueryBuilder(): QueryBuilder { $qb = $this->getObjectManager()->getRepository(Parametre::class)->createQueryBuilder('parametre') Loading @@ -75,11 +47,7 @@ class ParametreService return $qb; } /** * @param string $champ * @param string $ordre * @return Parametre[] */ /** @return Parametre[] */ public function getParametres(string $champ = 'ordre', string $ordre = 'ASC'): array { $qb = $this->createQueryBuilder() Loading @@ -88,12 +56,7 @@ class ParametreService return $result; } /** * @param Categorie $categorie * @param string $champ * @param string $ordre * @return Parametre[] */ /** @return Parametre[] */ public function getParametresByCategorie(Categorie $categorie, string $champ = 'ordre', string $ordre = 'ASC'): array { $qb = $this->createQueryBuilder() Loading @@ -104,10 +67,6 @@ class ParametreService return $result; } /** * @param int $id * @return Parametre|null */ public function getParametre(int $id): ?Parametre { $qb = $this->createQueryBuilder() Loading @@ -121,11 +80,6 @@ class ParametreService return $result; } /** * @param string $categorieCode * @param string $parametreCode * @return Parametre|null */ public function getParametreByCode(string $categorieCode, string $parametreCode): ?Parametre { $qb = $this->createQueryBuilder() Loading @@ -142,11 +96,6 @@ class ParametreService return $result; } /** * @param AbstractActionController $controller * @param string $param * @return Parametre */ public function getRequestedParametre(AbstractActionController $controller, string $param = 'parametre') : ?Parametre { $id = $controller->params()->fromRoute($param); Loading @@ -161,7 +110,7 @@ class ParametreService * @throws ParametreNotFoundException * @throws ParametreMalTypeException */ public function getValeurForParametre(string $categorieCode, string $parametreCode) public function getValeurForParametre(string $categorieCode, string $parametreCode): string|int|bool|null { $parametre = $this->getParametreByCode($categorieCode, $parametreCode); if ($parametre === null) { Loading