src/Entity/OffreAccueil/PresentationAssmat.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity\OffreAccueil;
  3. use \JsonSerializable;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\Validator\Constraints as Assert;
  6. /**
  7.  * @ORM\Entity
  8.  * @ORM\Table(name="efc.oa_assmat_presentation")
  9.  */
  10. class PresentationAssmat implements JsonSerializable
  11. {
  12.     use \App\Entity\Commun\IdTrait;
  13.     /**
  14.      * @Assert\NotNull()
  15.      * @ORM\OneToOne(targetEntity="App\Entity\AssistantMaternel\AssistantMaternel", inversedBy="presentation_assmat")
  16.      * @ORM\JoinColumn(name="id_assmat", referencedColumnName="id", nullable=false)
  17.      */
  18.     private $assmat;
  19.     /**
  20.      * @ORM\Column(type="string", length=600, nullable=true)
  21.      * @Assert\Length(
  22.      *      max = 600,
  23.      *      maxMessage = "Votre message est trop long."
  24.      * )
  25.      */
  26.     private $texte_libre;
  27.     /**
  28.      * @ORM\Column(type="string", length=600, nullable=true)
  29.      * @Assert\Length(
  30.      *      max = 600,
  31.      *      maxMessage = "Votre message est trop long."
  32.      * )
  33.      */
  34.     private $texte_libre_mod;
  35.     /**
  36.      * @ORM\Column(type="string", length=600, nullable=true)
  37.      * @Assert\Length(
  38.      *      max = 600,
  39.      *      maxMessage = "Votre message est trop long."
  40.      * )
  41.      */
  42.     private $formation_continue;
  43.     /**
  44.      * @ORM\Column(type="string", length=600, nullable=true)
  45.      * @Assert\Length(
  46.      *      max = 600,
  47.      *      maxMessage = "Votre message est trop long."
  48.      * )
  49.      */
  50.     private $formation_continue_mod;
  51.     /**
  52.      * @ORM\Column(type="string", length=1, nullable=true)
  53.      * @Assert\Regex(pattern="/^[FPEI]$/", message="Fixe, Portable, Email, Indetermine")
  54.      */
  55.     private $mode_contact_prefere;
  56.     /**
  57.      * @ORM\Column(type="string", length=5, nullable=true)
  58.      * @Assert\Regex(pattern="/^$|^(0[0-9]|1[0-9]|2[0-3]|[0-9]):[0-5][0-9]$/", message="Saisir une heure au format HH:MM")
  59.      */
  60.     private $heure_contact_matin_deb;
  61.     /**
  62.      * @ORM\Column(type="string", length=5, nullable=true)
  63.      * @Assert\Regex(pattern="/(^$|^(0[0-9]|1[0-9]|2[0-3]|[0-9]):[0-5][0-9]$)/", message="Saisir une heure au format HH:MM")
  64.      */
  65.     private $heure_contact_matin_fin;
  66.     /**
  67.      * @ORM\Column(type="string", length=5, nullable=true)
  68.      * @Assert\Regex(pattern="/(^$|^(0[0-9]|1[0-9]|2[0-3]|[0-9]):[0-5][0-9]$)/", message="Saisir une heure au format HH:MM")
  69.      */
  70.     private $heure_contact_aprem_deb;
  71.     /**
  72.      * @ORM\Column(type="string", length=5, nullable=true)
  73.      * @Assert\Regex(pattern="/(^$|^(0[0-9]|1[0-9]|2[0-3]|[0-9]):[0-5][0-9]$)/", message="Saisir une heure au format HH:MM")
  74.      */
  75.     private $heure_contact_aprem_fin;
  76.     /**
  77.      * Indique si l'assmat accepte d'accueillir les enfants tot le matin (accueil atypique au sens du cerfa)
  78.      * @ORM\Column(type="boolean", nullable=false, options={"default":false})
  79.      */
  80.     private $accepte_atypique_matin;
  81.     /**
  82.      * Indique si l'assmat accepte d'accueillir les enfants tard le soir (accueil atypique au sens du cerfa)
  83.      * @ORM\Column(type="boolean", nullable=false, options={"default":false})
  84.      */
  85.     private $accepte_atypique_soir;
  86.     /**
  87.      * Indique si l'assmat accepte d'accueillir les enfants en situation de handicap (au sens du cerfa)
  88.      * @ORM\Column(type="boolean", nullable=false, options={"default":false})
  89.      */
  90.     private $accepte_handicap;
  91.     use \App\Entity\Commun\DateCreationTrait;
  92.     use \App\Entity\Commun\DateModificationTrait;
  93.     /**
  94.      * @ORM\Column(type="datetime")
  95.      */
  96.     private $date_saisie_projet;
  97.     /**
  98.      * Get assmat
  99.      *
  100.      * @return Assmat
  101.      */
  102.     public function getAssmat()
  103.     {
  104.         return $this->assmat;
  105.     }
  106.     /**
  107.      * Set assmat
  108.      *
  109.      * @param Assmat $assmat
  110.      * 
  111.      * @return PresentationAssmat
  112.      */
  113.     public function setAssmat($assmat)
  114.     {
  115.         $this->assmat $assmat;
  116.         return $this;
  117.     }
  118.     /**
  119.      * Get texte_libre
  120.      *
  121.      * @return string
  122.      */
  123.     public function getTexteLibre()
  124.     {
  125.         return $this->texte_libre;
  126.     }
  127.     /**
  128.      * Set texte_libre
  129.      *
  130.      * @param string $texte_libre
  131.      *
  132.      * @return PresentationAssmat
  133.      */
  134.     public function setTexteLibre($texte_libre)
  135.     {
  136.         $this->texte_libre $texte_libre;
  137.         return $this;
  138.     }
  139.     /**
  140.      * Get texte_libre_mod
  141.      *
  142.      * @return string
  143.      */
  144.     public function getTexteLibreMod()
  145.     {
  146.         return $this->texte_libre_mod;
  147.     }
  148.     /**
  149.      * Set texte_libre_mod
  150.      *
  151.      * @param string $texte_libre_mod
  152.      *
  153.      * @return PresentationAssmat
  154.      */
  155.     public function setTexteLibreMod($texte_libre_mod)
  156.     {
  157.         //enregistre date de saisie du projet d'accueil pou rlea 1ere fois
  158.         if ($this->texte_libre_mod != $texte_libre_mod 
  159.                 && $this->date_saisie_projet == null
  160.                 && ($this->texte_libre_mod == '' || $this->texte_libre_mod == null)) {
  161.             $this->date_saisie_projet = new \DateTime();
  162.         }
  163.         $this->texte_libre_mod $texte_libre_mod;
  164.         return $this;
  165.     }
  166.     /**
  167.      * Get formation_continue
  168.      *
  169.      * @return string
  170.      */
  171.     public function getFormationContinue()
  172.     {
  173.         return $this->formation_continue;
  174.     }
  175.     /**
  176.      * Set formation_continue
  177.      *
  178.      * @param string $formation_continue
  179.      *
  180.      * @return PresentationAssmat
  181.      */
  182.     public function setFormationContinue($formation_continue)
  183.     {
  184.         $this->formation_continue $formation_continue;
  185.         return $this;
  186.     }
  187.     /**
  188.      * Get formation_continue_mod
  189.      *
  190.      * @return string
  191.      */
  192.     public function getFormationContinueMod()
  193.     {
  194.         return $this->formation_continue_mod;
  195.     }
  196.     /**
  197.      * Set formation_continue_mod
  198.      *
  199.      * @param string $formation_continue_mod
  200.      *
  201.      * @return PresentationAssmat
  202.      */
  203.     public function setFormationContinueMod($formation_continue_mod)
  204.     {
  205.         $this->formation_continue_mod $formation_continue_mod;
  206.         return $this;
  207.     }
  208.     /**
  209.      * Get mode_contact_prefere
  210.      *
  211.      * @return string
  212.      */
  213.     public function getModeContactPrefere()
  214.     {
  215.         return $this->mode_contact_prefere;
  216.     }
  217.     /**
  218.      * Set mode_contact_prefere
  219.      *
  220.      * @param string $mode_contact_prefere
  221.      *
  222.      * @return PresentationAssmat
  223.      */
  224.     public function setModeContactPrefere($mode_contact_prefere)
  225.     {
  226.         $this->mode_contact_prefere $mode_contact_prefere;
  227.         return $this;
  228.     }
  229.     /**
  230.      * Obtient le libellé pour le mode de contact préféré
  231.      *
  232.      * @return void
  233.      */
  234.     function getModeContactPrefereTexte()
  235.     {
  236.         switch ($this->mode_contact_prefere) {
  237.             case 'F':
  238.                 $texte "téléphone fixe";
  239.                 break;
  240.             case 'P':
  241.                 $texte "téléphone portable";
  242.                 break;
  243.             case 'E':
  244.                 $texte "courrier électronique";
  245.                 break;
  246.             default:
  247.                 $texte "non précisé";
  248.                 break;
  249.         }
  250.         return $texte;
  251.     }
  252.     /**
  253.      * Get heure_contact_matin_deb
  254.      *
  255.      * @return string
  256.      */
  257.     public function getHeureContactMatinDeb()
  258.     {
  259.         return $this->heure_contact_matin_deb;
  260.     }
  261.     /**
  262.      * Set heure_contact_matin_deb
  263.      *
  264.      * @param string $heure_contact_matin_deb
  265.      *
  266.      * @return PresentationAssmat
  267.      */
  268.     public function setHeureContactMatinDeb($heure_contact_matin_deb)
  269.     {
  270.         $this->heure_contact_matin_deb $heure_contact_matin_deb;
  271.         return $this;
  272.     }
  273.     /**
  274.      * Get heure_contact_matin_fin
  275.      *
  276.      * @return string
  277.      */
  278.     public function getHeureContactMatinFin()
  279.     {
  280.         return $this->heure_contact_matin_fin;
  281.     }
  282.     /**
  283.      * Set heure_contact_matin_fin
  284.      *
  285.      * @param string $heure_contact_matin_fin
  286.      *
  287.      * @return PresentationAssmat
  288.      */
  289.     public function setHeureContactMatinFin($heure_contact_matin_fin)
  290.     {
  291.         $this->heure_contact_matin_fin $heure_contact_matin_fin;
  292.         return $this;
  293.     }
  294.     /**
  295.      * Get heure_contact_aprem_deb
  296.      *
  297.      * @return string
  298.      */
  299.     public function getHeureContactApremDeb()
  300.     {
  301.         return $this->heure_contact_aprem_deb;
  302.     }
  303.     /**
  304.      * Set heure_contact_aprem_deb
  305.      *
  306.      * @param string $heure_contact_aprem_deb
  307.      *
  308.      * @return PresentationAssmat
  309.      */
  310.     public function setHeureContactApremDeb($heure_contact_aprem_deb)
  311.     {
  312.         $this->heure_contact_aprem_deb $heure_contact_aprem_deb;
  313.         return $this;
  314.     }
  315.     /**
  316.      * Get heure_contact_aprem_fin
  317.      *
  318.      * @return string
  319.      */
  320.     public function getHeureContactApremFin()
  321.     {
  322.         return $this->heure_contact_aprem_fin;
  323.     }
  324.     /**
  325.      * Set heure_contact_aprem_fin
  326.      *
  327.      * @param string $heure_contact_aprem_fin
  328.      *
  329.      * @return PresentationAssmat
  330.      */
  331.     public function setHeureContactApremFin($heure_contact_aprem_fin)
  332.     {
  333.         $this->heure_contact_aprem_fin $heure_contact_aprem_fin;
  334.         return $this;
  335.     }
  336.     /**
  337.      * Get accepte_atypique_matin
  338.      *
  339.      * @return bool
  340.      */
  341.     public function getAccepteAtypiqueMatin()
  342.     {
  343.         return $this->accepte_atypique_matin;
  344.     }
  345.     /**
  346.      * Set accepte_atypique_matin
  347.      *
  348.      * @param bool $accepte_atypique_matin
  349.      *
  350.      * @return PresentationAssmat
  351.      */
  352.     public function setAccepteAtypiqueMatin($accepte_atypique_matin)
  353.     {
  354.         $this->accepte_atypique_matin $accepte_atypique_matin;
  355.         return $this;
  356.     }
  357.     /**
  358.      * Get accepte_atypique_soir
  359.      *
  360.      * @return bool
  361.      */
  362.     public function getAccepteAtypiqueSoir()
  363.     {
  364.         return $this->accepte_atypique_soir;
  365.     }
  366.     /**
  367.      * Set accepte_atypique_soir
  368.      *
  369.      * @param bool $accepte_atypique_soir
  370.      *
  371.      * @return PresentationAssmat
  372.      */
  373.     public function setAccepteAtypiqueSoir($accepte_atypique_soir)
  374.     {
  375.         $this->accepte_atypique_soir $accepte_atypique_soir;
  376.         return $this;
  377.     }
  378.     /**
  379.      * Get accepte_handicap
  380.      *
  381.      * @return bool
  382.      */
  383.     public function getAccepteHandicap()
  384.     {
  385.         return $this->accepte_handicap;
  386.     }
  387.     /**
  388.      * Set accepte_handicap
  389.      *
  390.      * @param bool $accepte_handicap
  391.      *
  392.      * @return PresentationAssmat
  393.      */
  394.     public function setAccepteHandicap($accepte_handicap)
  395.     {
  396.         $this->accepte_handicap $accepte_handicap;
  397.         return $this;
  398.     }
  399.     /**
  400.      * Get date_saisie_projet
  401.      *
  402.      * @return date saisie projet accueil (texte libre pas vide)
  403.      */
  404.     public function getDateSaisieProjet()
  405.     {
  406.         return $this->date_saisie_projet;
  407.     }
  408.     /**
  409.      * Set date_saisie_projet
  410.      *
  411.      * @param Date $dateSaisieProjet
  412.      *
  413.      */
  414.     public function setDateSaisieProjet($dateSaisieProjet)
  415.     {
  416.         $this->date_saisie_projet $dateSaisieProjet;
  417.         return $this;
  418.     }
  419.     /*
  420.      * Implémentation de JsonSerializable
  421.      * Ne liste que les champs modifiables par les utilisateurs
  422.      */
  423.     public function jsonSerialize()
  424.     {
  425.         return [
  426.             'texte_libre' => $this->texte_libre,
  427.             'texte_libre_mod' => $this->texte_libre_mod,
  428.             'formation_continue' => $this->formation_continue,
  429.             'formation_continue_mod' => $this->formation_continue_mod,
  430.         ];
  431.     }
  432.     /**
  433.      * Obtient une nouvelle instance de PresentationAssmat, initialisée à partir du tableau associatif fourni en paramètre
  434.      *
  435.      * @param array $data
  436.      * @return PresentationAssmat
  437.      */
  438.     public static function createFromArray(array $data)
  439.     {
  440.         $newInstance = new PresentationAssmat();
  441.         return $newInstance->initFromArray($data);
  442.     }
  443.     /**
  444.      * mappe les propriétés sur l'instance à partir d'un tableau associatif
  445.      *
  446.      * @param array $data
  447.      * @return void
  448.      */
  449.     public function initFromArray(array $data)
  450.     {
  451.         foreach ($data as $prop => $value) {
  452.             $this->{$prop} = $value;
  453.         }
  454.         return $this;
  455.     }
  456. }