src/Entity/Referentiel/Commune.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Referentiel;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use App\Entity\AssistantMaternel\AssistantMaternel;
  5. /**
  6.  * @ORM\Entity
  7.  * @ORM\Table(name="efc.ref_commune")
  8.  */
  9. class Commune {
  10.     // TODO factoriser avec des traits (ex : code postal)
  11.     use \App\Entity\Commun\IdTrait;
  12. // <editor-fold defaultstate="collapsed" desc="Attributs privés">
  13.     /**
  14.      * @ORM\Column(type="string", length=70)
  15.      */
  16.     private $code_externe;
  17.     /**
  18.      * @ORM\Column(type="string", length=5)
  19.      */
  20.     private $code_insee;
  21.     /**
  22.      * @ORM\Column(type="string", length=5)
  23.      */
  24.     private $code_postal;
  25.     /**
  26.      * @ORM\Column(type="string", length=100)
  27.      */
  28.     private $libelle;
  29.     /**
  30.      * @ORM\OneToMany(targetEntity="App\Entity\AssistantMaternel\AssistantMaternel", mappedBy="commune")
  31.      */
  32.     private $assmats;
  33.     /**
  34.      * @ORM\OneToMany(targetEntity="App\Entity\MAM\MAM", mappedBy="commune")
  35.      */
  36.     private $mams;
  37.     /**
  38.      * @ORM\ManyToMany(targetEntity="App\Entity\Referentiel\Canton", inversedBy="communes")
  39.      * @ORM\JoinTable(name="efc.ref_communes_cantons")
  40.      */
  41.     private $cantons;
  42. // </editor-fold>
  43. // <editor-fold desc="Accesseurs">
  44.     /**
  45.      * Set libelle
  46.      *
  47.      * @param string $libelle
  48.      *
  49.      * @return Commune
  50.      */
  51.     public function setLibelle($libelle) {
  52.         $this->libelle $libelle;
  53.         return $this;
  54.     }
  55.     /**
  56.      * Get libelle
  57.      *
  58.      * @return string
  59.      */
  60.     public function getLibelle() {
  61.         return $this->libelle;
  62.     }
  63.     /**
  64.      * Get assmats
  65.      *
  66.      * @return \Doctrine\Common\Collections\Collection
  67.      */
  68.     public function getAssistantsMaternels() {
  69.         return $this->assmats;
  70.     }
  71.     /**
  72.      * Set codeExterne
  73.      *
  74.      * @param integer $code_externe
  75.      *
  76.      * @return Commune
  77.      */
  78.     public function setCodeExterne($code_externe) {
  79.         $this->code_externe $code_externe;
  80.         return $this;
  81.     }
  82.     /**
  83.      * Get codeExterne
  84.      *
  85.      * @return integer
  86.      */
  87.     public function getCodeExterne() {
  88.         return $this->code_externe;
  89.     }
  90.     /**
  91.      * Set codeInsee
  92.      *
  93.      * @param string $codeInsee
  94.      *
  95.      * @return Commune
  96.      */
  97.     public function setCodeInsee($codeInsee) {
  98.         $this->code_insee $codeInsee;
  99.         return $this;
  100.     }
  101.     /**
  102.      * Get codeInsee
  103.      *
  104.      * @return string
  105.      */
  106.     public function getCodeInsee() {
  107.         return $this->code_insee;
  108.     }
  109.     /**
  110.      * Set codePostal
  111.      *
  112.      * @param string $codePostal
  113.      *
  114.      * @return Commune
  115.      */
  116.     public function setCodePostal($codePostal) {
  117.         $this->code_postal $codePostal;
  118.         return $this;
  119.     }
  120.     /**
  121.      * Get codePostal
  122.      *
  123.      * @return string
  124.      */
  125.     public function getCodePostal() {
  126.         return $this->code_postal;
  127.     }
  128.     /**
  129.      * Get canton
  130.      *
  131.      * @return Canton
  132.      */
  133.     public function getCantons() {
  134.         return $this->cantons;
  135.     }
  136. // </editor-fold>
  137. // <editor-fold desc="Méthodes publiques">
  138.     /**
  139.      * Constructor
  140.      */
  141.     public function __construct() {
  142.     }
  143.     public function __toString() {
  144.         return $this->libelle;
  145.     }
  146.     /**
  147.      * Add assmat
  148.      *
  149.      * @param AssistantMaternel $assmat
  150.      *
  151.      * @return Commune
  152.      */
  153.     public function addAssistantMaternel(AssistantMaternel $assmat) {
  154.         $this->assmats[] = $assmat;
  155.         return $this;
  156.     }
  157.     /**
  158.      * Remove assmat
  159.      *
  160.      * @param AssistantMaternel $assmat
  161.      */
  162.     public function removeAssistantMaternel(AssistantMaternel $assmat) {
  163.         $this->assmats->removeElement($assmat);
  164.     }
  165.     /**
  166.      * Add canton
  167.      *
  168.      * @param Canton $canton
  169.      *
  170.      * @return Canton
  171.      */
  172.     public function addCanton(Commune $canton) {
  173.         $this->cantons[] = $canton;
  174.         return $this;
  175.     }
  176.     /**
  177.      * Remove canton
  178.      *
  179.      * @param Canton $canton
  180.      */
  181.     public function removeCanton(Canton $canton) {
  182.         $this->cantons->removeElement($canton);
  183.     }
  184. // </editor-fold>
  185. }