<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass="App\Repository\TicketRepository")
*/
class Ticket
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $type;
/**
* @ORM\Column(type="string", length=255)
* @Assert\NotNull()
* @Assert\Length(min=2)
*/
private $object;
/**
* @ORM\Column(type="string", length=255)
* @Assert\NotNull()
* @Assert\Length(min=2)
*/
private $lastName;
/**
* @ORM\Column(type="string", length=255)
* @Assert\NotNull()
* @Assert\Length(min=2)
*/
private $firstName;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $phoneNumber;
/**
* @ORM\Column(type="text")
* @Assert\NotNull()
* @Assert\Length(min=2)
*/
private $message;
/**
* @ORM\Column(type="datetime")
*/
private $createDate;
/**
* @ORM\Column(type="string", length=255)
* @Assert\Email()
*/
private $email;
private $gmailLink;
/**
* @ORM\Column(type="boolean")
*/
private $treat = false;
/**
* @ORM\ManyToOne(targetEntity=User::class, inversedBy="tickets")
*/
private $user;
/**
* @ORM\OneToMany(targetEntity=ResponseTicket::class, mappedBy="ticket", orphanRemoval=true)
*/
private $responseTickets;
/**
* @ORM\Column(type="boolean")
*/
private $close =false;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $treatAt;
private $responseTicketNotOpened;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $enterprise;
public function __construct()
{
$this->responseTickets = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(string $type): self
{
if (!in_array($type, ['EXT', 'ticket'])) {
throw new \InvalidArgumentException("Invalid type");
}
$this->type = $type;
return $this;
}
public function getObject(): ?string
{
return $this->object;
}
public function setObject(string $object): self
{
$this->object = $object;
return $this;
}
/**
* @return mixed
*/
public function getLastName()
{
return $this->lastName;
}
/**
* @param mixed $lastName
*/
public function setLastName($lastName): void
{
$this->lastName = $lastName;
}
/**
* @return mixed
*/
public function getFirstName()
{
return $this->firstName;
}
/**
* @param mixed $firstName
*/
public function setFirstName($firstName): void
{
$this->firstName = $firstName;
}
public function getPhoneNumber(): ?string
{
return $this->phoneNumber;
}
public function setPhoneNumber(?string $phoneNumber): self
{
$this->phoneNumber = $phoneNumber;
return $this;
}
public function getMessage(): ?string
{
return $this->message;
}
public function setMessage(string $message): self
{
$this->message = $message;
return $this;
}
public function getCreateDate(): ?\DateTimeInterface
{
return $this->createDate;
}
public function setCreateDate(\DateTimeInterface $createDate): self
{
$this->createDate = $createDate;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(string $email): self
{
$this->email = $email;
return $this;
}
public function getTreat(): ?bool
{
return $this->treat;
}
public function setTreat(bool $treat): self
{
$this->treat = $treat;
return $this;
}
/**
* @return mixed
*/
public function getGmailLink()
{
return $this->gmailLink;
}
/**
* @param mixed $gmailLink
*/
public function setGmailLink($gmailLink)
{
$this->gmailLink = $gmailLink;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
/**
* @return Collection|ResponseTicket[]
*/
public function getResponseTickets(): Collection
{
return $this->responseTickets;
}
public function addResponse(ResponseTicket $response): self
{
if (!$this->responseTickets->contains($response)) {
$this->responseTickets[] = $response;
$response->setTicket($this);
}
return $this;
}
public function removeResponse(ResponseTicket $response): self
{
if ($this->responseTickets->contains($response)) {
$this->responseTickets->removeElement($response);
// set the owning side to null (unless already changed)
if ($response->getTicket() === $this) {
$response->setTicket(null);
}
}
return $this;
}
public function getClose(): ?bool
{
return $this->close;
}
public function setClose(?bool $close): self
{
$this->close = $close;
return $this;
}
public function getTreatAt(): ?\DateTimeInterface
{
return $this->treatAt;
}
public function setTreatAt(?\DateTimeInterface $treatAt): self
{
$this->treatAt = $treatAt;
return $this;
}
/**
* @return mixed
*/
public function getResponseTicketNotOpened()
{
return $this->responseTicketNotOpened;
}
/**
* @param mixed $responseTicketNotOpened
*/
public function setResponseTicketNotOpened($responseTicketNotOpened): void
{
$this->responseTicketNotOpened = $responseTicketNotOpened;
}
public function getEnterprise(): ?string
{
return $this->enterprise;
}
public function setEnterprise(?string $enterprise): self
{
$this->enterprise = $enterprise;
return $this;
}
}