src/Entity/RDV.php line 19

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. use App\Entity\Intervention;
  8. use App\Entity\User;
  9. /**
  10.  *
  11.  * Represente le planning des médécins probablement.
  12.  * @ORM\Table()
  13.  * @ORM\Entity()
  14.  *
  15.  */
  16. class RDV
  17. {
  18.     /**
  19.      * @var integer $id
  20.      *
  21.      * @ORM\Id
  22.      * @ORM\Column(type="integer")
  23.      * @ORM\GeneratedValue(strategy="AUTO")
  24.      *
  25.      * @Groups({"read"})
  26.      */
  27.     private $id;
  28.     /**
  29.      * @var \DateTime
  30.      *
  31.      * @ORM\Column(type="datetime")
  32.      * @Assert\NotBlank()
  33.      * @Groups({"read"})
  34.      */
  35.     private $date;
  36.     /**
  37.      * @var \DateTime
  38.      *
  39.      * @ORM\Column(type="boolean")
  40.      */
  41.     private $accept false;
  42.     /**
  43.      * Le médecin qui accepte
  44.      * @var User
  45.      *
  46.      * @ORM\ManyToOne(targetEntity=User::class)
  47.      * @ORM\JoinColumn(onDelete="SET NULL")
  48.      */
  49.     private $user;
  50.     /**
  51.      * @var Intervention
  52.      *
  53.      * @ORM\ManyToOne(targetEntity=Intervention::class)
  54.      * @ORM\JoinColumn(onDelete="SET NULL")
  55.      * @Groups({"read"})
  56.      */
  57.     private $intervention;
  58.     /**
  59.      * Constructor of Planning Entity
  60.      */
  61.     public function __construct()
  62.     {
  63.         $this->accept false;
  64.         $this->duree 30;
  65.         $this->date = new \DateTime();
  66.     }
  67.     public function __toString()
  68.     {
  69.         return (string) $this->getId();
  70.     }
  71.     /**
  72.      * Get id
  73.      *
  74.      * @return integer
  75.      */
  76.     public function getId()
  77.     {
  78.         return $this->id;
  79.     }
  80.     /**
  81.      * Get duree
  82.      *
  83.      * @return string
  84.      */
  85.     public function getDuree()
  86.     {
  87.         return $this->duree;
  88.     }
  89.     /**
  90.      * Set duree
  91.      *
  92.      * @param string duree
  93.      *
  94.      * @return RDV
  95.      */
  96.     public function setDuree($duree)
  97.     {
  98.         $this->duree $duree;
  99.         return $this;
  100.     }
  101.     /**
  102.      * Set dateInfo
  103.      *
  104.      * @param \DateTime $dateInfo
  105.      * @return RDV
  106.      */
  107.     public function setDate($dateInfo)
  108.     {
  109.         $this->date $dateInfo;
  110.         return $this;
  111.     }
  112.     /**
  113.      * Get dateInfo
  114.      *
  115.      * @return \DateTime
  116.      */
  117.     public function getDate()
  118.     {
  119.         return $this->date;
  120.     }
  121.     /**
  122.      * Get getDateInfoString
  123.      *
  124.      * @return string
  125.      * @Groups({"read"})
  126.      */
  127.     public function getDateString()
  128.     {
  129.         return $this->date->format('Y-m-d');
  130.     }
  131.     /**
  132.      * @return Intervention
  133.      */
  134.     public function getIntervention()
  135.     {
  136.         return $this->intervention;
  137.     }
  138.     /**
  139.      * @param Intervention $intervention
  140.      */
  141.     public function setIntervention($intervention)
  142.     {
  143.         $this->intervention $intervention;
  144.     }
  145.     /**
  146.      * @return \DateTime
  147.      */
  148.     public function getAccept()
  149.     {
  150.         return $this->accept;
  151.     }
  152.     /**
  153.      * @param boolean $accept
  154.      */
  155.     public function setAccept($accept)
  156.     {
  157.         $this->accept $accept;
  158.     }
  159.     /**
  160.      * @return User
  161.      */
  162.     public function getUser()
  163.     {
  164.         return $this->user;
  165.     }
  166.     /**
  167.      * @param User $user
  168.      */
  169.     public function setUser($user)
  170.     {
  171.         $this->user $user;
  172.     }
  173. }