src/Entity/CancelEventApplication.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CancelEventApplicationRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Gedmo\Mapping\Annotation as Gedmo;
  6. use Symfony\Component\Validator\Constraints as Assert;
  7. /**
  8.  * @ORM\Entity(repositoryClass=CancelEventApplicationRepository::class)
  9.  */
  10. class CancelEventApplication
  11. {
  12.     const STATUS_OPEN 'open'// the cancel application is open
  13.     const STATUS_ACCEPTED 'accepted'// the cancel application accepted
  14.     const STATUS_REFUSED 'refused'// the cancel application refused
  15.     const STATUS_DELETED 'deleted'// the cancel application deleted
  16.     /**
  17.      * Available statuses for the cancel event application
  18.      */
  19.     const STATUSES = [
  20.         self::STATUS_OPEN,
  21.         self::STATUS_ACCEPTED,
  22.         self::STATUS_REFUSED,
  23.         self::STATUS_DELETED
  24.     ];
  25.     /**
  26.      * @ORM\Id
  27.      * @ORM\GeneratedValue
  28.      * @ORM\Column(type="integer")
  29.      */
  30.     private $id;
  31.     /**
  32.      * @ORM\ManyToOne(targetEntity=Event::class, inversedBy="cancelEventApplications")
  33.      * @ORM\JoinColumn(nullable=false)
  34.      */
  35.     private $event;
  36.     /**
  37.      * @ORM\ManyToOne(targetEntity=Specialist::class, inversedBy="cancelEventApplications")
  38.      * @ORM\JoinColumn(nullable=true)
  39.      */
  40.     private $specialist;
  41.     /**
  42.      * @ORM\ManyToOne(targetEntity=Specialist::class)
  43.      * @ORM\JoinColumn(nullable=true)
  44.      */
  45.     private $newSpecialist;
  46.     /**
  47.      * @ORM\Column(type="string", length=50, nullable=true)
  48.      * @Assert\Choice(choices=self::STATUSES)
  49.      */
  50.     private $status self::STATUS_OPEN;
  51.     /**
  52.      * @ORM\Column(type="string", length=255, nullable=true)
  53.      * @Assert\NotBlank(message="La raison destinée à l'administrateur doit être remplit")
  54.      */
  55.     private $reasonToAdmin;
  56.     /**
  57.      * @ORM\Column(type="string", length=255, nullable=true)
  58.      */
  59.     private $reasonToSpecialist;
  60.     /**
  61.      * @ORM\Column(type="string", length=255, nullable=true)
  62.      */
  63.     private $reasonToCompany;
  64.     /**
  65.      * @ORM\Column(type="string", length=255, nullable=true)
  66.      */
  67.     private $reasonToClient;
  68.     /**
  69.      * @ORM\Column(type="datetime", options={"default": "CURRENT_TIMESTAMP"})
  70.      * @Gedmo\Timestampable(on="create")
  71.      */
  72.     private $createdAt;
  73.     /**
  74.      * @ORM\Column(type="datetime", options={"default": "CURRENT_TIMESTAMP"})
  75.      * @Gedmo\Timestampable(on="update")
  76.      */
  77.     private $updatedAt;
  78.     /**
  79.      * @ORM\Column(type="string", length=255, nullable=true)
  80.      */
  81.     private $updatedBy;
  82.     public function __construct()
  83.     {
  84.         $this->createdAt = new \DateTime();
  85.         $this->updatedAt = new \DateTime();
  86.     }
  87.     public function getId(): ?int
  88.     {
  89.         return $this->id;
  90.     }
  91.     public function getEvent(): ?Event
  92.     {
  93.         return $this->event;
  94.     }
  95.     public function setEvent(?Event $event): self
  96.     {
  97.         $this->event $event;
  98.         return $this;
  99.     }
  100.     public function getSpecialist(): ?Specialist
  101.     {
  102.         return $this->specialist;
  103.     }
  104.     public function setSpecialist(?Specialist $specialist): self
  105.     {
  106.         $this->specialist $specialist;
  107.         return $this;
  108.     }
  109.     public function getNewSpecialist(): ?Specialist
  110.     {
  111.         return $this->newSpecialist;
  112.     }
  113.     public function setNewSpecialist(?Specialist $newSpecialist): self
  114.     {
  115.         $this->newSpecialist $newSpecialist;
  116.         return $this;
  117.     }
  118.     
  119.     public function getStatus(): ?string
  120.     {
  121.         return $this->status;
  122.     }
  123.     public function setStatus(?string $status): self
  124.     {
  125.         $this->status $status;
  126.         return $this;
  127.     }
  128.     
  129.     public function getReasonToAdmin(): ?string
  130.     {
  131.         return $this->reasonToAdmin;
  132.     }
  133.     public function setReasonToAdmin(?string $reasonToAdmin): self
  134.     {
  135.         $this->reasonToAdmin $reasonToAdmin;
  136.         return $this;
  137.     }
  138.     public function getReasonToSpecialist(): ?string
  139.     {
  140.         return $this->reasonToSpecialist;
  141.     }
  142.     public function setReasonToSpecialist(?string $reasonToSpecialist): self
  143.     {
  144.         $this->reasonToSpecialist $reasonToSpecialist;
  145.         return $this;
  146.     }
  147.     public function getReasonToCompany(): ?string
  148.     {
  149.         return $this->reasonToCompany;
  150.     }
  151.     public function setReasonToCompany(?string $reasonToCompany): self
  152.     {
  153.         $this->reasonToCompany $reasonToCompany;
  154.         return $this;
  155.     }
  156.     public function getReasonToClient(): ?string
  157.     {
  158.         return $this->reasonToClient;
  159.     }
  160.     public function setReasonToClient(?string $reasonToClient): self
  161.     {
  162.         $this->reasonToClient $reasonToClient;
  163.         return $this;
  164.     }
  165.     
  166.     public function getCreatedAt(): ?\DateTimeInterface
  167.     {
  168.         return $this->createdAt;
  169.     }
  170.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  171.     {
  172.         $this->createdAt $createdAt;
  173.         return $this;
  174.     }
  175.     public function getUpdatedAt(): ?\DateTimeInterface
  176.     {
  177.         return $this->updatedAt;
  178.     }
  179.     public function setUpdatedAt(\DateTimeInterface $updatedAt): self
  180.     {
  181.         $this->updatedAt $updatedAt;
  182.         return $this;
  183.     }
  184.     public function getUpdatedBy(): ?string
  185.     {
  186.         return $this->updatedBy;
  187.     }
  188.     public function setUpdatedBy(?string $updatedBy): self
  189.     {
  190.         $this->updatedBy $updatedBy;
  191.         return $this;
  192.     }
  193.     /**
  194.      * Vérif si la demande n'a pas encore été traitée
  195.      * @return bool
  196.      */
  197.     public function isOpen(): bool
  198.     {
  199.         return ($this->status === self::STATUS_OPEN) ? true false;
  200.     }
  201.     /**
  202.      * Vérif si la demande a été acceptée
  203.      * @return bool
  204.      */
  205.     public function isAccepted(): bool
  206.     {
  207.         return ($this->status === self::STATUS_ACCEPTED) ? true false;
  208.     }
  209.     /**
  210.      * Vérif si la demande a été refusée
  211.      * @return bool
  212.      */
  213.     public function isRefused(): bool
  214.     {
  215.         return ($this->status === self::STATUS_REFUSED) ? true false;
  216.     }
  217.     /**
  218.      * Vérif si la demande a été supprimée
  219.      * @return bool
  220.      */
  221.     public function isDeleted(): bool
  222.     {
  223.         return ($this->status === self::STATUS_DELETED) ? true false;
  224.     }
  225.     /**
  226.      * Vérif si la demande est cloturée
  227.      * @return bool
  228.      */
  229.     public function isClosed(): bool
  230.     {
  231.         return ($this->isAccepted() || $this->isRefused() || $this->isDeleted()) ? true false;
  232.     }
  233. }