src/Entity/Ticket.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\Validator\Constraints as Assert;
  7. /**
  8.  * @ORM\Entity(repositoryClass="App\Repository\TicketRepository")
  9.  */
  10. class Ticket
  11. {
  12.     /**
  13.      * @ORM\Id()
  14.      * @ORM\GeneratedValue()
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255)
  20.      */
  21.     private $type;
  22.     /**
  23.      * @ORM\Column(type="string", length=255)
  24.      * @Assert\NotNull()
  25.      * @Assert\Length(min=2)
  26.      */
  27.     private $object;
  28.     /**
  29.      * @ORM\Column(type="string", length=255)
  30.      * @Assert\NotNull()
  31.      * @Assert\Length(min=2)
  32.      */
  33.     private $lastName;
  34.     /**
  35.      * @ORM\Column(type="string", length=255)
  36.      * @Assert\NotNull()
  37.      * @Assert\Length(min=2)
  38.      */
  39.     private $firstName;
  40.     /**
  41.      * @ORM\Column(type="string", length=255, nullable=true)
  42.      */
  43.     private $phoneNumber;
  44.     /**
  45.      * @ORM\Column(type="text")
  46.      * @Assert\NotNull()
  47.      * @Assert\Length(min=2)
  48.      */
  49.     private $message;
  50.     /**
  51.      * @ORM\Column(type="datetime")
  52.      */
  53.     private $createDate;
  54.     /**
  55.      * @ORM\Column(type="string", length=255)
  56.      *  @Assert\Email()
  57.      */
  58.     private $email;
  59.     private $gmailLink;
  60.     /**
  61.      * @ORM\Column(type="boolean")
  62.      */
  63.     private $treat false;
  64.     /**
  65.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="tickets")
  66.      */
  67.     private $user;
  68.     /**
  69.      * @ORM\OneToMany(targetEntity=ResponseTicket::class, mappedBy="ticket", orphanRemoval=true)
  70.      */
  71.     private $responseTickets;
  72.     /**
  73.      * @ORM\Column(type="boolean")
  74.      */
  75.     private $close =false;
  76.     /**
  77.      * @ORM\Column(type="datetime", nullable=true)
  78.      */
  79.     private $treatAt;
  80.     private $responseTicketNotOpened;
  81.     /**
  82.      * @ORM\Column(type="string", length=255, nullable=true)
  83.      */
  84.     private $enterprise;
  85.     public function __construct()
  86.     {
  87.         $this->responseTickets = new ArrayCollection();
  88.     }
  89.     public function getId(): ?int
  90.     {
  91.         return $this->id;
  92.     }
  93.     public function getType(): ?string
  94.     {
  95.         return $this->type;
  96.     }
  97.     public function setType(string $type): self
  98.     {
  99.         if (!in_array($type, ['EXT''ticket'])) {
  100.             throw new \InvalidArgumentException("Invalid type");
  101.         }
  102.         $this->type $type;
  103.         return $this;
  104.     }
  105.     public function getObject(): ?string
  106.     {
  107.         return $this->object;
  108.     }
  109.     public function setObject(string $object): self
  110.     {
  111.         $this->object $object;
  112.         return $this;
  113.     }
  114.     /**
  115.      * @return mixed
  116.      */
  117.     public function getLastName()
  118.     {
  119.         return $this->lastName;
  120.     }
  121.     /**
  122.      * @param mixed $lastName
  123.      */
  124.     public function setLastName($lastName): void
  125.     {
  126.         $this->lastName $lastName;
  127.     }
  128.     /**
  129.      * @return mixed
  130.      */
  131.     public function getFirstName()
  132.     {
  133.         return $this->firstName;
  134.     }
  135.     /**
  136.      * @param mixed $firstName
  137.      */
  138.     public function setFirstName($firstName): void
  139.     {
  140.         $this->firstName $firstName;
  141.     }
  142.     public function getPhoneNumber(): ?string
  143.     {
  144.         return $this->phoneNumber;
  145.     }
  146.     public function setPhoneNumber(?string $phoneNumber): self
  147.     {
  148.         $this->phoneNumber $phoneNumber;
  149.         return $this;
  150.     }
  151.     public function getMessage(): ?string
  152.     {
  153.         return $this->message;
  154.     }
  155.     public function setMessage(string $message): self
  156.     {
  157.         $this->message $message;
  158.         return $this;
  159.     }
  160.     public function getCreateDate(): ?\DateTimeInterface
  161.     {
  162.         return $this->createDate;
  163.     }
  164.     public function setCreateDate(\DateTimeInterface $createDate): self
  165.     {
  166.         $this->createDate $createDate;
  167.         return $this;
  168.     }
  169.     public function getEmail(): ?string
  170.     {
  171.         return $this->email;
  172.     }
  173.     public function setEmail(string $email): self
  174.     {
  175.         $this->email $email;
  176.         return $this;
  177.     }
  178.     public function getTreat(): ?bool
  179.     {
  180.         return $this->treat;
  181.     }
  182.     public function setTreat(bool $treat): self
  183.     {
  184.         $this->treat $treat;
  185.         return $this;
  186.     }
  187.     /**
  188.      * @return mixed
  189.      */
  190.     public function getGmailLink()
  191.     {
  192.         return $this->gmailLink;
  193.     }
  194.     /**
  195.      * @param mixed $gmailLink
  196.      */
  197.     public function setGmailLink($gmailLink)
  198.     {
  199.         $this->gmailLink $gmailLink;
  200.     }
  201.     public function getUser(): ?User
  202.     {
  203.         return $this->user;
  204.     }
  205.     public function setUser(?User $user): self
  206.     {
  207.         $this->user $user;
  208.         return $this;
  209.     }
  210.     /**
  211.      * @return Collection|ResponseTicket[]
  212.      */
  213.     public function getResponseTickets(): Collection
  214.     {
  215.         return $this->responseTickets;
  216.     }
  217.     public function addResponse(ResponseTicket $response): self
  218.     {
  219.         if (!$this->responseTickets->contains($response)) {
  220.             $this->responseTickets[] = $response;
  221.             $response->setTicket($this);
  222.         }
  223.         return $this;
  224.     }
  225.     public function removeResponse(ResponseTicket $response): self
  226.     {
  227.         if ($this->responseTickets->contains($response)) {
  228.             $this->responseTickets->removeElement($response);
  229.             // set the owning side to null (unless already changed)
  230.             if ($response->getTicket() === $this) {
  231.                 $response->setTicket(null);
  232.             }
  233.         }
  234.         return $this;
  235.     }
  236.     public function getClose(): ?bool
  237.     {
  238.         return $this->close;
  239.     }
  240.     public function setClose(?bool $close): self
  241.     {
  242.         $this->close $close;
  243.         return $this;
  244.     }
  245.     public function getTreatAt(): ?\DateTimeInterface
  246.     {
  247.         return $this->treatAt;
  248.     }
  249.     public function setTreatAt(?\DateTimeInterface $treatAt): self
  250.     {
  251.         $this->treatAt $treatAt;
  252.         return $this;
  253.     }
  254.     /**
  255.      * @return mixed
  256.      */
  257.     public function getResponseTicketNotOpened()
  258.     {
  259.         return $this->responseTicketNotOpened;
  260.     }
  261.     /**
  262.      * @param mixed $responseTicketNotOpened
  263.      */
  264.     public function setResponseTicketNotOpened($responseTicketNotOpened): void
  265.     {
  266.         $this->responseTicketNotOpened $responseTicketNotOpened;
  267.     }
  268.     public function getEnterprise(): ?string
  269.     {
  270.         return $this->enterprise;
  271.     }
  272.     public function setEnterprise(?string $enterprise): self
  273.     {
  274.         $this->enterprise $enterprise;
  275.         return $this;
  276.     }
  277. }