<?php
namespace App\Entity;
use App\Repository\TicketRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
/**
* @ORM\Entity(repositoryClass=TicketRepository::class)
* @Vich\Uploadable
*/
class Ticket
{
const STATUS_EN_COURS = "En cours";
const STATUS_FERMER = "Fermer";
const STATUS_ATTENTE = "En attente retour client";
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $title;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $description;
/**
* @ORM\Column(type="string", length=512, nullable=true)
*/
private $url;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $nomEnfant;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $nomParent;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $tag;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $pj;
/**
* @Vich\UploadableField(mapping="frontend_image", fileNameProperty="pj")
*
* @var File|null
*/
private $imgFile;
/**
* @ORM\ManyToOne(targetEntity=Contact::class, inversedBy="ticket")
*/
private $personneAssocie;
/**
* @ORM\ManyToOne(targetEntity=User::class, inversedBy="ticket")
*/
private $createdBy;
/**
* @ORM\Column(type="string", length=512, nullable=true)
*/
private $status;
/**
* @ORM\OneToMany(targetEntity=TicketComment::class, mappedBy="ticket", cascade={"persist", "remove"})
* @ORM\OrderBy({"creationDate" = "ASC"})
*/
private $comments;
/**
* @ORM\Column(type="datetime")
*/
private $creationDate;
public function __construct()
{
$this->creationDate = new \Datetime();
$this->comments = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(?string $title): self
{
$this->title = $title;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getUrl(): ?string
{
return $this->url;
}
public function setUrl(?string $url): self
{
$this->url = $url;
return $this;
}
public function getNomEnfant(): ?string
{
return $this->nomEnfant;
}
public function setNomEnfant(?string $nomEnfant): self
{
$this->nomEnfant = $nomEnfant;
return $this;
}
public function getNomParent(): ?string
{
return $this->nomParent;
}
public function setNomParent(?string $nomParent): self
{
$this->nomParent = $nomParent;
return $this;
}
public function getTag(): ?string
{
return $this->tag;
}
public function setTag(?string $tag): self
{
$this->tag = $tag;
return $this;
}
public function getPj(): ?string
{
return $this->pj;
}
public function setPj(?string $pj): self
{
$this->pj = $pj;
return $this;
}
/**
* If manually uploading a file (i.e. not using Symfony Form) ensure an instance
* of 'UploadedFile' is injected into this setter to trigger the update. If this
* bundle's configuration parameter 'inject_on_load' is set to 'true' this setter
* must be able to accept an instance of 'File' as the bundle will inject one here
* during Doctrine hydration.
*
* @param File|\Symfony\Component\HttpFoundation\File\UploadedFile|null $imageFile
*/
public function setImgFile(?File $imageFile = null)
{
$this->imgFile = $imageFile;
return true;
}
public function getImgFile(): ?File
{
return $this->imgFile;
}
public function getPersonneAssocie(): ?Contact
{
return $this->personneAssocie;
}
public function setPersonneAssocie(?Contact $personneAssocie): self
{
$this->personneAssocie = $personneAssocie;
return $this;
}
public function getCreatedBy(): ?User
{
return $this->createdBy;
}
public function setCreatedBy(?User $createdBy): self
{
$this->createdBy = $createdBy;
return $this;
}
public function getStatus(): ?string
{
return $this->status;
}
public function setStatus(?string $status): self
{
$this->status = $status;
return $this;
}
public function getCreationDate(): ?\DateTimeInterface
{
return $this->creationDate;
}
public function setCreationDate(\DateTimeInterface $creationDate): self
{
$this->creationDate = $creationDate;
return $this;
}
/**
* @return Collection|TicketComment[]
*/
public function getComments(): Collection
{
return $this->comments;
}
public function addComment(TicketComment $comment): self
{
if (!$this->comments->contains($comment)) {
$this->comments[] = $comment;
$comment->setTicket($this);
}
return $this;
}
}