src/Entity/Planning.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Symfony\Component\Validator\Constraints as Assert;
  5. use ApiPlatform\Core\Annotation\ApiResource;
  6. use Symfony\Component\Serializer\Annotation\Groups;
  7. /**
  8.  * @author <erwan> <erwan@kodiom.com>
  9.  *
  10.  * Represente le planning des médécins probablement.
  11.  * @ORM\Table()
  12.  * @ORM\Entity(repositoryClass="App\Entity\PlanningRepository")
  13.  * @ApiResource()
  14.  */
  15. class Planning
  16. {
  17.     /**
  18.      * @var integer $id
  19.      *
  20.      * @ORM\Id
  21.      * @ORM\Column(type="integer")
  22.      * @ORM\GeneratedValue(strategy="AUTO")
  23.      *
  24.      * @Groups({"read"})
  25.      */
  26.     private $id;
  27.     /**
  28.      * @var text
  29.      *
  30.      * @ORM\Column(type="integer")
  31.      * @Assert\NotBlank()
  32.      * @Groups({"read"})
  33.      */
  34.     private $duree;
  35.     /**
  36.      * @var \DateTime
  37.      *
  38.      * @ORM\Column(type="datetime")
  39.      * @Assert\NotBlank()
  40.      * @Groups({"read"})
  41.      */
  42.     private $dateInfo;
  43.     /**
  44.      * Constructor of Planning Entity
  45.      */
  46.     public function __construct()
  47.     {
  48.         $this->duree 30;
  49.         $this->dateInfo = new \DateTime();
  50.     }
  51.     public function __toString()
  52.     {
  53.         return ($this->getDuree()) ? 'Duree -> '.$this->getDuree() : 'Unknown';
  54.     }
  55.     /**
  56.      * Get id
  57.      *
  58.      * @return integer
  59.      */
  60.     public function getId()
  61.     {
  62.         return $this->id;
  63.     }
  64.     /**
  65.      * Get duree
  66.      *
  67.      * @return string
  68.      */
  69.     public function getDuree()
  70.     {
  71.         return $this->duree;
  72.     }
  73.     /**
  74.      * Set duree
  75.      *
  76.      * @param string duree
  77.      *
  78.      * @return Planning
  79.      */
  80.     public function setDuree($duree)
  81.     {
  82.         $this->duree $duree;
  83.         return $this;
  84.     }
  85.     /**
  86.      * Set dateInfo
  87.      *
  88.      * @param \DateTime $dateInfo
  89.      * @return Planning
  90.      */
  91.     public function setDateInfo($dateInfo)
  92.     {
  93.         $this->dateInfo $dateInfo;
  94.         return $this;
  95.     }
  96.     /**
  97.      * Get dateInfo
  98.      *
  99.      * @return \DateTime
  100.      */
  101.     public function getDateInfo()
  102.     {
  103.         return $this->dateInfo;
  104.     }
  105.     /**
  106.      * Get getDateInfoString
  107.      *
  108.      * @return \DateTime
  109.      * @Groups({"read"})
  110.      */
  111.     public function getDateInfoString()
  112.     {
  113.         return $this->dateInfo->format('Y-m-d');
  114.     }
  115.     /**
  116.      * Get getDateInfoString
  117.      *
  118.      * @return \DateTime
  119.      * @Groups({"read"})
  120.      */
  121.     public function getDateTimeInfoString()
  122.     {
  123.         return $this->dateInfo->format('c');
  124.     }
  125. }