src/NoteBundle/Form/Model/BulletinModel.php line 225

Open in your IDE?
  1. <?php
  2. namespace NoteBundle\Form\Model;
  3. use CoreBundle\Entity\Branche;
  4. use CoreBundle\Entity\GroupStudent;
  5. use CoreBundle\Entity\Module;
  6. use CoreBundle\Entity\Periode;
  7. use CoreBundle\Entity\Secteur;
  8. class BulletinModel implements \JsonSerializable
  9. {
  10.     /**
  11.      * @var Branche
  12.      */
  13.     private $branche;
  14.     /**
  15.      * @var Secteur
  16.      */
  17.     private $secteur;
  18.     /**
  19.      * @var Periode
  20.      */
  21.     private $periode;
  22.     /**
  23.      * @var int
  24.      */
  25.     private $quad;
  26.     /**
  27.      * @var string
  28.      */
  29.     private $type;
  30.     /**
  31.      * @var string
  32.      */
  33.     private $format;
  34.     /**
  35.      * @var \DateTime
  36.      */
  37.     private $dateFrom;
  38.     /**
  39.      * @var \DateTime
  40.      */
  41.     private $dateTo;
  42.     /**
  43.      * @var string
  44.      */
  45.     private $template;
  46.     /**
  47.      * @return Periode
  48.      */
  49.     public function getPeriode()
  50.     {
  51.         return $this->periode;
  52.     }
  53.     /**
  54.      * @param Periode $periode
  55.      * @return BulletinModel
  56.      */
  57.     public function setPeriode(Periode $periode): self
  58.     {
  59.         $this->periode $periode;
  60.         return $this;
  61.     }
  62.     /**
  63.      * @return string
  64.      */
  65.     public function getType()
  66.     {
  67.         return $this->type;
  68.     }
  69.     /**
  70.      * @param string $type
  71.      * @return BulletinModel
  72.      */
  73.     public function setType(string $type): self
  74.     {
  75.         $this->type $type;
  76.         return $this;
  77.     }
  78.     /**
  79.      * @return \DateTime
  80.      */
  81.     public function getDateFrom()
  82.     {
  83.         return $this->dateFrom;
  84.     }
  85.     /**
  86.      * @param \DateTime $dateFrom
  87.      * @return BulletinModel
  88.      */
  89.     public function setDateFrom(\DateTime $dateFrom): self
  90.     {
  91.         $this->dateFrom $dateFrom;
  92.         return $this;
  93.     }
  94.     /**
  95.      * @return \DateTime
  96.      */
  97.     public function getDateTo()
  98.     {
  99.         return $this->dateTo;
  100.     }
  101.     /**
  102.      * @param \DateTime $dateTo
  103.      * @return BulletinModel
  104.      */
  105.     public function setDateTo(\DateTime $dateTo): self
  106.     {
  107.         $this->dateTo $dateTo;
  108.         return $this;
  109.     }
  110.     /**
  111.      * @return int
  112.      */
  113.     public function getQuad()
  114.     {
  115.         return $this->quad;
  116.     }
  117.     /**
  118.      * @param int $quad
  119.      * @return BulletinModel
  120.      */
  121.     public function setQuad(int $quad): self
  122.     {
  123.         $this->quad $quad;
  124.         return $this;
  125.     }
  126.     /**
  127.      * @return Branche
  128.      */
  129.     public function getBranche(): ?Branche
  130.     {
  131.         return $this->branche;
  132.     }
  133.     /**
  134.      * @param Branche $branche
  135.      * @return BulletinModel
  136.      */
  137.     public function setBranche(Branche $branche): self
  138.     {
  139.         $this->branche $branche;
  140.         return $this;
  141.     }
  142.     /**
  143.      * @return Secteur
  144.      */
  145.     public function getSecteur(): ?Secteur
  146.     {
  147.         return $this->secteur;
  148.     }
  149.     /**
  150.      * @param Secteur $secteur
  151.      * @return BulletinModel
  152.      */
  153.     public function setSecteur(Secteur $secteur): self
  154.     {
  155.         $this->secteur $secteur;
  156.         return $this;
  157.     }
  158.     /**
  159.      * @return string
  160.      */
  161.     public function getFormat(): ?string
  162.     {
  163.         return $this->format;
  164.     }
  165.     /**
  166.      * @param string $format
  167.      * @return BulletinModel
  168.      */
  169.     public function setFormat(string $format): self
  170.     {
  171.         $this->format $format;
  172.         return $this;
  173.     }
  174.     public function getTemplate(): ?string
  175.     {
  176.         return $this->template;
  177.     }
  178.     public function setTemplate(string $template): self
  179.     {
  180.         $this->template $template;
  181.         return $this;
  182.     }
  183.     /**
  184.      * Specify data which should be serialized to JSON
  185.      * @link https://php.net/manual/en/jsonserializable.jsonserialize.php
  186.      * @return mixed data which can be serialized by <b>json_encode</b>,
  187.      * which is a value of any type other than a resource.
  188.      * @since 5.4.0
  189.      */
  190.     public function jsonSerialize()
  191.     {
  192.         return [
  193.             'branche' => $this->branche->getId(),
  194.             'secteur' => (null !== $this->secteur) ? $this->secteur->getId() : null,
  195.             'periode' => $this->periode->getId(),
  196.             'quad' => $this->quad,
  197.             'type' => $this->type,
  198.             'format' => $this->format,
  199.             'from' => $this->dateFrom->format('Y-m-d'),
  200.             'to' => $this->dateTo->format('Y-m-d'),
  201.             'template' => $this->template
  202.         ];
  203.     }
  204. }