src/Entity/MAM/MAM.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity\MAM;
  3. use Doctrine\ORM\Mapping as ORM;
  4. /**
  5.  * @ORM\Entity(repositoryClass="App\Repository\MAM\MAMRepository")
  6.  * @ORM\Table(
  7.  *     name="efc.mam",
  8.  *     uniqueConstraints={
  9.  *         @ORM\UniqueConstraint(name="mam_un",columns={"id_fonctionnel"})
  10.  *     }
  11.  * )
  12.  */
  13. class MAM
  14. {
  15.     // use App\Entity\Commun\PersonneTrait;
  16.     // TODO factoriser avec des traits (ex : code postal)
  17.     // <editor-fold defaultstate="collapsed" desc="Attributs privés">
  18.     use \App\Entity\Commun\IdTrait;
  19.     use \App\Entity\Commun\PhotosTrait;
  20.     /**
  21.      * @ORM\Column(type="string", length=70)
  22.      */
  23.     private $id_fonctionnel;
  24.     /**
  25.      * @ORM\Column(type="string", length=70)
  26.      */
  27.     private $nom;
  28.     /**
  29.      * @ORM\Column(type="string", length=100)
  30.      */
  31.     private $adresse;
  32.     /**
  33.      * @ORM\Column(type="string", length=100, nullable=true)
  34.      */
  35.     private $adresse_complement;
  36.     /**
  37.      * @ORM\Column(type="string", length=5)
  38.      */
  39.     private $code_postal;
  40.     /**
  41.      * @ORM\Column(type="string", length=100, nullable=true)
  42.      */
  43.     private $bureau_distributeur;
  44.     /**
  45.      * @ORM\Column(type="string", length=10, nullable=true)
  46.      */
  47.     private $tel_fixe;
  48.     /**
  49.      * @ORM\Column(type="string", length=10, nullable=true)
  50.      */
  51.     private $tel_portable;
  52.     /**
  53.      * @ORM\Column(type="boolean")
  54.      */
  55.     private $participe;
  56.     /**
  57.      * @ORM\Column(type="boolean")
  58.      */
  59.     private $archive;
  60.     /**
  61.      * @ORM\Column(type="boolean")
  62.      */
  63.     private $oppose;
  64.     /**
  65.      * @ORM\Column(type="boolean")
  66.      */
  67.     private $supprime;
  68.     /**
  69.      * @ORM\Column(type="string", length=250, nullable=true)
  70.      */
  71.     private $email;
  72.     /**
  73.      * @ORM\Column(type="datetime")
  74.      */
  75.     private $date_maj_departement;
  76.     /**
  77.      * @ORM\Column(type="datetime", nullable=true)
  78.      */
  79.     private $date_maj_mam;
  80.     /**
  81.      * @ORM\ManyToOne(targetEntity="App\Entity\Referentiel\SecteurPmi", inversedBy="mams")
  82.      * @ORM\JoinColumn(name="id_secteur_pmi", referencedColumnName="id")
  83.      */
  84.     private $secteur_pmi;
  85.     /**
  86.      * @ORM\ManyToOne(targetEntity="App\Entity\Referentiel\Commune", inversedBy="mams")
  87.      * @ORM\JoinColumn(name="id_commune", referencedColumnName="id")
  88.      */
  89.     private $commune;
  90.     /**
  91.      * @ORM\ManyToOne(targetEntity="App\Entity\Referentiel\Canton", inversedBy="mams")
  92.      * @ORM\JoinColumn(name="id_canton", referencedColumnName="id")
  93.      */
  94.     private $canton;
  95.     /**
  96.      * @ORM\OneToMany(targetEntity="App\Entity\AssistantMaternel\AssistantMaternel", mappedBy="mam")
  97.      */
  98.     private $assmats;
  99.     /**
  100.      * Préférences de publication site grand public
  101.      * 
  102.      * @ORM\OneToOne(targetEntity="App\Entity\OffreAccueil\PreferencesPublicationMAM", mappedBy="mam")
  103.      */
  104.     private $preferences_publication;
  105.     /**
  106.      * Présentation offre d'accueil site grand public
  107.      * 
  108.      * @ORM\OneToOne(targetEntity="App\Entity\OffreAccueil\PresentationMAM", mappedBy="mam")
  109.      */
  110.     private $presentation_mam;
  111.     
  112.     /**
  113.      * @ORM\OneToMany(targetEntity="App\Entity\OffreAccueil\Photo", mappedBy="mam")
  114.      */
  115.     private $photos;
  116.     // </editor-fold>
  117.     // <editor-fold desc="Accesseurs">
  118.     function getIdFonctionnel()
  119.     {
  120.         return $this->id_fonctionnel;
  121.     }
  122.     function getNom()
  123.     {
  124.         return $this->nom;
  125.     }
  126.     function getAdresse()
  127.     {
  128.         return $this->adresse;
  129.     }
  130.     function getAdresseComplement()
  131.     {
  132.         return $this->adresse_complement;
  133.     }
  134.     function getCodePostal()
  135.     {
  136.         return $this->code_postal;
  137.     }
  138.     function getBureauDistributeur()
  139.     {
  140.         return $this->bureau_distributeur;
  141.     }
  142.     function getTelFixe()
  143.     {
  144.         return $this->tel_fixe;
  145.     }
  146.     function getTelPortable()
  147.     {
  148.         return $this->tel_portable;
  149.     }
  150.     function getParticipe()
  151.     {
  152.         return $this->participe;
  153.     }
  154.     function getArchive()
  155.     {
  156.         return $this->archive;
  157.     }
  158.     function getOppose()
  159.     {
  160.         return $this->oppose;
  161.     }
  162.     function getSupprime()
  163.     {
  164.         return $this->supprime;
  165.     }
  166.     function getEmail()
  167.     {
  168.         return $this->email;
  169.     }
  170.     function getDateMajDepartement()
  171.     {
  172.         return $this->date_maj_departement;
  173.     }
  174.     function getDateMajMAM()
  175.     {
  176.         return $this->date_maj_mam;
  177.     }
  178.     function getSecteurPMI()
  179.     {
  180.         return $this->secteur_pmi;
  181.     }
  182.     function getCommune()
  183.     {
  184.         return $this->commune;
  185.     }
  186.     function getCanton()
  187.     {
  188.         return $this->canton;
  189.     }
  190.     function getAssmats()
  191.     {
  192.         return $this->assmats;
  193.     }
  194.     public function setIdFonctionnel($idFonctionnel)
  195.     {
  196.         $this->id_fonctionnel $idFonctionnel;
  197.         return $this;
  198.     }
  199.     public function setNom($nom)
  200.     {
  201.         $this->nom $nom;
  202.         return $this;
  203.     }
  204.     public function setAdresse($adresse)
  205.     {
  206.         $this->adresse $adresse;
  207.         return $this;
  208.     }
  209.     public function setAdresseComplement($adresseComplement)
  210.     {
  211.         $this->adresse_complement $adresseComplement;
  212.         return $this;
  213.     }
  214.     public function setCodePostal($codePostal)
  215.     {
  216.         $this->code_postal $codePostal;
  217.         return $this;
  218.     }
  219.     public function setBureauDistributeur($bureauDistributeur)
  220.     {
  221.         $this->bureau_distributeur $bureauDistributeur;
  222.         return $this;
  223.     }
  224.     public function setTelFixe($telFixe)
  225.     {
  226.         $this->tel_fixe $telFixe;
  227.         return $this;
  228.     }
  229.     public function setTelPortable($telPortable)
  230.     {
  231.         $this->tel_portable $telPortable;
  232.         return $this;
  233.     }
  234.     public function setParticipe($participe)
  235.     {
  236.         $this->participe $participe;
  237.         return $this;
  238.     }
  239.     public function setArchive($archive)
  240.     {
  241.         $this->archive $archive;
  242.         return $this;
  243.     }
  244.     public function setOppose($oppose)
  245.     {
  246.         $this->oppose $oppose;
  247.         return $this;
  248.     }
  249.     public function setSupprime($supprime)
  250.     {
  251.         $this->supprime $supprime;
  252.         return $this;
  253.     }
  254.     public function setEmail($email)
  255.     {
  256.         $this->email $email;
  257.         return $this;
  258.     }
  259.     public function setDateMajDepartement($dateMajDepartement)
  260.     {
  261.         $this->date_maj_departement $dateMajDepartement;
  262.     }
  263.     public function setDateMajMAM($dateMajMAM)
  264.     {
  265.         $this->date_maj_mam $dateMajMAM;
  266.         return $this;
  267.     }
  268.     public function setSecteurPMI($secteurPMI)
  269.     {
  270.         $this->secteur_pmi $secteurPMI;
  271.         return $this;
  272.     }
  273.     public function setCommune($commune)
  274.     {
  275.         $this->commune $commune;
  276.         return $this;
  277.     }
  278.     public function setCanton($canton)
  279.     {
  280.         $this->canton $canton;
  281.         return $this;
  282.     }
  283.     /**
  284.      * Set preferences_publication
  285.      *
  286.      * @param PreferencesPublicationMAM $preferences_publication
  287.      *
  288.      * @return MAM
  289.      */
  290.     public function setPreferencesPublication($preferences_publication)
  291.     {
  292.         $this->preferences_publication $preferences_publication;
  293.         return $this;
  294.     }
  295.     /**
  296.      * Get preferences_publication
  297.      *
  298.      * @return PreferencesPublicationMAM
  299.      */
  300.     public function getPreferencesPublication()
  301.     {
  302.         return $this->preferences_publication;
  303.     }
  304.     /**
  305.      * Set presentation_mam
  306.      *
  307.      * @param PresentationMAM $presentation_mam
  308.      *
  309.      * @return MAM
  310.      */
  311.     public function setPresentationMAM($presentation_mam)
  312.     {
  313.         $this->presentation_mam $presentation_mam;
  314.         return $this;
  315.     }
  316.     /**
  317.      * Get presentation_mam
  318.      *
  319.      * @return PresentationMAM
  320.      */
  321.     public function getPresentationMAM()
  322.     {
  323.         return $this->presentation_mam;
  324.     }
  325.     /**
  326.      * Obtient la liste des assmat non archivé de la MAM
  327.      * @return array
  328.      */
  329.     public function getAssmatsNonArchive()
  330.     {
  331.         $assmatActives = array();
  332.         foreach ($this->assmats as $assmat) {
  333.             if (!$assmat->getArchiveCalculeMam()) {
  334.                 $assmatActives[] = $assmat;
  335.             }
  336.         }
  337.         return $assmatActives;
  338.     }
  339.     // </editor-fold>
  340.     // <editor-fold desc="Méthodes publiques">
  341.     /**
  342.      * Constructor
  343.      */
  344.     public function __construct()
  345.     { }
  346.     /*
  347.      * Implémentation de JsonSerializable
  348.      * Ne liste que les champs modifiables par les utilisateurs
  349.      */
  350.     public function jsonSerialize()
  351.     {
  352.         return [
  353.             'id' => $this->id,
  354.             'email' => $this->email,
  355.             'archive' => $this->archive,
  356.             'supprime' => $this->supprime,
  357.         ];
  358.     }
  359.     
  360.     /**
  361.      * Obtient une nouvelle instance de PresentationAssmat, initialisée à partir du tableau associatif fourni en paramètre
  362.      *
  363.      * @param array $data
  364.      * @return PresentationAssmat
  365.      */
  366.     public static function createFromArray(array $data)
  367.     {
  368.         $newInstance = new MAM();
  369.         return $newInstance->initFromArray($data);
  370.     }
  371.     /**
  372.      * mappe les propriétés sur l'instance à partir d'un tableau associatif
  373.      *
  374.      * @param array $data
  375.      * @return void
  376.      */
  377.     public function initFromArray(array $data)
  378.     {
  379.         foreach ($data as $prop => $value) {
  380.             $this->{$prop} = $value;
  381.         }
  382.         return $this;
  383.     }
  384.     // </editor-fold>
  385. }