<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use App\Repository\TicketRepository;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ORM\Entity(repositoryClass=TicketRepository::class)
*/
class Ticket
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $subject;
/**
* @ORM\Column(type="datetime")
*/
private $createdAt;
/**
* @ORM\OneToMany(targetEntity=Messaging::class, mappedBy="ticket")
*/
private $messagings;
/**
* @ORM\ManyToOne(targetEntity=User::class, inversedBy="tickets")
* @ORM\JoinColumn(nullable=true)
* @Groups("post:read")
*/
private $createdBy;
/**
* @ORM\Column(type="boolean")
*/
private $isOpen;
/**
* @ORM\ManyToOne(targetEntity=Product::class)
* @ORM\JoinColumn(nullable=true)
*/
private $product;
/**
* @ORM\Column(type="string", length=255)
* @Groups("post:read")
*/
private $numero;
private $nbMessage;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $DestinataireId;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $typeDestinataire;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $expeditaireId;
/**
* @ORM\Column(type="string", length=20, nullable=true)
*/
private $typeExpeditaire;
public function __construct()
{
$this->messagings = new ArrayCollection();
$this->createdAt = new \DateTime();
$this->isOpen = true;
}
public function getId(): ?int
{
return $this->id;
}
public function getSubject(): ?string
{
return $this->subject;
}
public function setSubject(string $subject): self
{
$this->subject = $subject;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
/**
* @return Collection|Messaging[]
*/
public function getMessagings(): Collection
{
return $this->messagings;
}
public function addMessaging(Messaging $messaging): self
{
if (!$this->messagings->contains($messaging)) {
$this->messagings[] = $messaging;
$messaging->setTicket($this);
}
return $this;
}
public function removeMessaging(Messaging $messaging): self
{
if ($this->messagings->contains($messaging)) {
$this->messagings->removeElement($messaging);
// set the owning side to null (unless already changed)
if ($messaging->getTicket() === $this) {
$messaging->setTicket(null);
}
}
return $this;
}
public function getCreatedBy(): ?User
{
return $this->createdBy;
}
public function setCreatedBy(?User $createdBy): self
{
$this->createdBy = $createdBy;
return $this;
}
public function getIsOpen(): ?bool
{
return $this->isOpen;
}
public function setIsOpen(bool $isOpen): self
{
$this->isOpen = $isOpen;
return $this;
}
public function getProduct(): ?Product
{
return $this->product;
}
public function setProduct(?Product $product): self
{
$this->product = $product;
return $this;
}
public function getNumero(): ?string
{
return $this->numero;
}
public function setNumero(string $numero): self
{
$this->numero = $numero;
return $this;
}
public function getNbMessage(): ?int
{
return $this->nbMessage;
}
public function setNbMessage(int $nbMessage): self
{
$this->nbMessage = $nbMessage;
return $this;
}
public function getDestinataireId(): ?int
{
return $this->DestinataireId;
}
public function setDestinataireId(?int $DestinataireId): self
{
$this->DestinataireId = $DestinataireId;
return $this;
}
public function getTypeDestinataire(): ?string
{
return $this->typeDestinataire;
}
public function setTypeDestinataire(?string $typeDestinataire): self
{
$this->typeDestinataire = $typeDestinataire;
return $this;
}
public function getExpeditaireId(): ?int
{
return $this->expeditaireId;
}
public function setExpeditaireId(?int $expeditaireId): self
{
$this->expeditaireId = $expeditaireId;
return $this;
}
public function getTypeExpeditaire(): ?string
{
return $this->typeExpeditaire;
}
public function setTypeExpeditaire(?string $typeExpeditaire): self
{
$this->typeExpeditaire = $typeExpeditaire;
return $this;
}
}