src/Entity/Appointment.php line 23

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Entity;
  4. use ApiPlatform\Core\Annotation\ApiResource;
  5. use App\Repository\AppointmentRepository;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Ksante\CoreBundle\Entity\Channel;
  8. use Ksante\CoreBundle\Entity\Traits\TimestampableTrait;
  9. use Symfony\Component\Serializer\Annotation\Groups;
  10. /**
  11.  * @ORM\Entity(repositoryClass=AppointmentRepository::class)
  12.  *
  13.  * @ORM\Table(name="ksante_appointment")
  14.  *
  15.  * @ORM\HasLifecycleCallbacks()
  16.  *
  17.  * @ApiResource()
  18.  */
  19. class Appointment implements TimetableInterface
  20. {
  21.     use TimestampableTrait;
  22.     public const STATUS_PRE_BOOK 'pre_book';
  23.     public const STATUS_INCOMING 'incoming';
  24.     public const STATUS_CALL 'call';
  25.     public const STATUS_ABSENT 'absent';
  26.     public const STATUS_NOT_TAKEN 'not_taken';
  27.     public const STATUS_LOCKED 'locked';
  28.     public const STATUS_CANCELED 'canceled';
  29.     public const EMAIL_REMINDER_NOT_SENT 'no_email_sent';
  30.     public const EMAIL_REMINDER_48_HOURS_BEFORE '48_hours_before';
  31.     public const EMAIL_REMINDER_24_HOURS_BEFORE '24_hours_before';
  32.     public const EMAIL_REMINDER_POST_APPOINTMENT 'post_appointment';
  33.     public const EMAIL_REMINDER_CANCELED 'canceled';
  34.     public const REMINDER_STATUS = [
  35.         => Appointment::EMAIL_REMINDER_24_HOURS_BEFORE,
  36.         => Appointment::EMAIL_REMINDER_48_HOURS_BEFORE,
  37.     ];
  38.     /**
  39.      * @ORM\Id
  40.      *
  41.      * @ORM\GeneratedValue
  42.      *
  43.      * @ORM\Column(type="integer")
  44.      *
  45.      * @Groups({"CustomerGroup", "read"})
  46.      */
  47.     private $id;
  48.     /**
  49.      * @ORM\ManyToOne(targetEntity=Channel::class)
  50.      *
  51.      * @ORM\JoinColumn(nullable=true)
  52.      *
  53.      * @Groups({"read", "write", "create"})
  54.      */
  55.     private ?Channel $channel;
  56.     /**
  57.      * @ORM\ManyToOne(targetEntity=Customer::class, inversedBy="appointments")
  58.      *
  59.      * @Groups({"read", "write", "create"})
  60.      */
  61.     private Customer $customer;
  62.     /**
  63.      * @ORM\ManyToOne(targetEntity=Diet::class, inversedBy="appointments")
  64.      *
  65.      * @Groups({"read", "write", "create"})
  66.      */
  67.     private Diet $diet;
  68.     /**
  69.      * @ORM\Column(type="datetime")
  70.      *
  71.      * @Groups({"CustomerGroup", "read", "write", "create"})
  72.      */
  73.     private \DateTime $date;
  74.     /**
  75.      * @ORM\Column(type="integer", nullable=true)
  76.      *
  77.      * @Groups({"CustomerGroup", "write", "create"})
  78.      */
  79.     private int $type;
  80.     /**
  81.      * @ORM\Column(type="string")
  82.      *
  83.      * @Groups({"CustomerGroup", "write", "create"})
  84.      */
  85.     private string $status;
  86.     /**
  87.      * @ORM\Column(type="string")
  88.      *
  89.      * @Groups({"CustomerGroup", "write", "create"})
  90.      */
  91.     private string $reminderStatus self::EMAIL_REMINDER_NOT_SENT;
  92.     public function getId(): ?int
  93.     {
  94.         return $this->id;
  95.     }
  96.     public function getChannel()
  97.     {
  98.         return $this->channel;
  99.     }
  100.     public function setChannel(?Channel $channel): self
  101.     {
  102.         $this->channel $channel;
  103.         return $this;
  104.     }
  105.     public function getCustomer(): ?Customer
  106.     {
  107.         return $this->customer;
  108.     }
  109.     public function setCustomer(?Customer $customer): self
  110.     {
  111.         $this->customer $customer;
  112.         return $this;
  113.     }
  114.     public function getDiet(): ?Diet
  115.     {
  116.         return $this->diet;
  117.     }
  118.     public function setDiet(?Diet $diet): self
  119.     {
  120.         $this->diet $diet;
  121.         return $this;
  122.     }
  123.     public function getDate(): \DateTime
  124.     {
  125.         return $this->date;
  126.     }
  127.     public function setDate(\DateTime $date): self
  128.     {
  129.         $this->date $date;
  130.         return $this;
  131.     }
  132.     public function getType(): ?int
  133.     {
  134.         return $this->type;
  135.     }
  136.     public function setType(int $type): self
  137.     {
  138.         $this->type $type;
  139.         return $this;
  140.     }
  141.     public function getStatus(): ?string
  142.     {
  143.         return $this->status;
  144.     }
  145.     public function setStatus(string $status): self
  146.     {
  147.         $this->status $status;
  148.         return $this;
  149.     }
  150.     public function getReminderStatus(): ?string
  151.     {
  152.         return $this->reminderStatus;
  153.     }
  154.     public function setReminderStatus(string $reminderStatus): self
  155.     {
  156.         $this->reminderStatus $reminderStatus;
  157.         return $this;
  158.     }
  159. }