Loading src/Octopus/Entity/Db/Individu.php +13 −0 Original line number Diff line number Diff line Loading @@ -48,12 +48,15 @@ class Individu { /** @var ArrayCollection (IndividuAffectation) */ private $affectations; /** @var ArrayCollection (IndividuCompte) */ private $comptes; /** @var ArrayCollection (IndividuInscription) */ private $inscriptions; public function __construct() { $this->affectations = new ArrayCollection(); $this->comptes = new ArrayCollection(); $this->inscriptions = new ArrayCollection(); } Loading Loading @@ -234,6 +237,16 @@ class Individu { return $inscriptions; } /** * @return IndividuCompte[] */ public function getComptes() : array { $comptes = $this->comptes->toArray(); array_filter($comptes, function(IndividuCompte $a) { return $a->getType()->getNom() === IndividuCompteType::INDIVIDU_COMPTE_UTILISATEUR;}); return $comptes; } /** * @return string */ Loading src/Octopus/Entity/Db/IndividuCompte.php 0 → 100644 +60 −0 Original line number Diff line number Diff line <?php namespace Octopus\Entity\Db; use DateTime; class IndividuCompte { /** @var integer */ private $id; /** @var Individu */ private $individu; /** @var IndividuCompteType */ private $type; /** @var string */ private $login; /** @var string */ private $email; /** * @return int */ public function getId(): int { return $this->id; } /** * @return Individu */ public function getIndividu(): Individu { return $this->individu; } /** * @return IndividuCompteType */ public function getType(): IndividuCompteType { return $this->type; } /** * @return string */ public function getLogin() { return $this->login; } /** * @return string */ public function getEmail() { return $this->email; } } No newline at end of file src/Octopus/Entity/Db/IndividuCompteType.php 0 → 100644 +43 −0 Original line number Diff line number Diff line <?php namespace Octopus\Entity\Db; use DateTime; class IndividuCompteType { const INDIVIDU_COMPTE_ADMINISTRATEUR = "administrateur"; const INDIVIDU_COMPTE_UTILISATEUR = "utilisateur"; /** @var integer */ private $id; /** @var string */ private $nom; /** @var string */ private $libelle; /** * @return int */ public function getId() { return $this->id; } /** * @return string */ public function getNom(): string { return $this->nom; } /** * @return string */ public function getLibelle(): string { return $this->libelle; } } No newline at end of file src/Octopus/Entity/Db/Mapping/Octopus.Entity.Db.Individu.dcm.xml +1 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ <field name="dateModification" type="date" column="D_MODIF" nullable="false"/> <one-to-many target-entity="Octopus\Entity\Db\IndividuAffectation" mapped-by="individu" field="affectations"/> <one-to-many target-entity="Octopus\Entity\Db\IndividuCompte" mapped-by="individu" field="comptes"/> <one-to-many target-entity="Octopus\Entity\Db\IndividuInscription" mapped-by="individu" field="inscriptions"/> </entity> Loading src/Octopus/Entity/Db/Mapping/Octopus.Entity.Db.IndividuCompte.dcm.xml 0 → 100644 +19 −0 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"> <entity name="Octopus\Entity\Db\IndividuCompte" table="INDIVIDU_COMPTE"> <id name="id" type="integer" column="ID"> <generator strategy="IDENTITY"/> </id> <many-to-one target-entity="Octopus\Entity\Db\Individu" field="individu"> <join-column name="INDIVIDU_ID" referenced-column-name="C_INDIVIDU_CHAINE" /> </many-to-one> <many-to-one target-entity="Octopus\Entity\Db\IndividuCompteType" field="type"> <join-column name="TYPE_ID" referenced-column-name="ID" /> </many-to-one> <field name="login" column="LOGIN" type="string" length="15" nullable="false"/> <field name="email" column="EMAIL" type="string" length="255" nullable="false"/> </entity> </doctrine-mapping> No newline at end of file Loading
src/Octopus/Entity/Db/Individu.php +13 −0 Original line number Diff line number Diff line Loading @@ -48,12 +48,15 @@ class Individu { /** @var ArrayCollection (IndividuAffectation) */ private $affectations; /** @var ArrayCollection (IndividuCompte) */ private $comptes; /** @var ArrayCollection (IndividuInscription) */ private $inscriptions; public function __construct() { $this->affectations = new ArrayCollection(); $this->comptes = new ArrayCollection(); $this->inscriptions = new ArrayCollection(); } Loading Loading @@ -234,6 +237,16 @@ class Individu { return $inscriptions; } /** * @return IndividuCompte[] */ public function getComptes() : array { $comptes = $this->comptes->toArray(); array_filter($comptes, function(IndividuCompte $a) { return $a->getType()->getNom() === IndividuCompteType::INDIVIDU_COMPTE_UTILISATEUR;}); return $comptes; } /** * @return string */ Loading
src/Octopus/Entity/Db/IndividuCompte.php 0 → 100644 +60 −0 Original line number Diff line number Diff line <?php namespace Octopus\Entity\Db; use DateTime; class IndividuCompte { /** @var integer */ private $id; /** @var Individu */ private $individu; /** @var IndividuCompteType */ private $type; /** @var string */ private $login; /** @var string */ private $email; /** * @return int */ public function getId(): int { return $this->id; } /** * @return Individu */ public function getIndividu(): Individu { return $this->individu; } /** * @return IndividuCompteType */ public function getType(): IndividuCompteType { return $this->type; } /** * @return string */ public function getLogin() { return $this->login; } /** * @return string */ public function getEmail() { return $this->email; } } No newline at end of file
src/Octopus/Entity/Db/IndividuCompteType.php 0 → 100644 +43 −0 Original line number Diff line number Diff line <?php namespace Octopus\Entity\Db; use DateTime; class IndividuCompteType { const INDIVIDU_COMPTE_ADMINISTRATEUR = "administrateur"; const INDIVIDU_COMPTE_UTILISATEUR = "utilisateur"; /** @var integer */ private $id; /** @var string */ private $nom; /** @var string */ private $libelle; /** * @return int */ public function getId() { return $this->id; } /** * @return string */ public function getNom(): string { return $this->nom; } /** * @return string */ public function getLibelle(): string { return $this->libelle; } } No newline at end of file
src/Octopus/Entity/Db/Mapping/Octopus.Entity.Db.Individu.dcm.xml +1 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ <field name="dateModification" type="date" column="D_MODIF" nullable="false"/> <one-to-many target-entity="Octopus\Entity\Db\IndividuAffectation" mapped-by="individu" field="affectations"/> <one-to-many target-entity="Octopus\Entity\Db\IndividuCompte" mapped-by="individu" field="comptes"/> <one-to-many target-entity="Octopus\Entity\Db\IndividuInscription" mapped-by="individu" field="inscriptions"/> </entity> Loading
src/Octopus/Entity/Db/Mapping/Octopus.Entity.Db.IndividuCompte.dcm.xml 0 → 100644 +19 −0 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"> <entity name="Octopus\Entity\Db\IndividuCompte" table="INDIVIDU_COMPTE"> <id name="id" type="integer" column="ID"> <generator strategy="IDENTITY"/> </id> <many-to-one target-entity="Octopus\Entity\Db\Individu" field="individu"> <join-column name="INDIVIDU_ID" referenced-column-name="C_INDIVIDU_CHAINE" /> </many-to-one> <many-to-one target-entity="Octopus\Entity\Db\IndividuCompteType" field="type"> <join-column name="TYPE_ID" referenced-column-name="ID" /> </many-to-one> <field name="login" column="LOGIN" type="string" length="15" nullable="false"/> <field name="email" column="EMAIL" type="string" length="255" nullable="false"/> </entity> </doctrine-mapping> No newline at end of file