src/Entity/Ticket.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use App\Repository\TicketRepository;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Symfony\Component\Serializer\Annotation\Groups;
  8. /**
  9.  * @ORM\Entity(repositoryClass=TicketRepository::class)
  10.  */
  11. class Ticket
  12. {
  13.     /**
  14.      * @ORM\Id()
  15.      * @ORM\GeneratedValue()
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="string", length=255, nullable=true)
  21.      */
  22.     private $subject;
  23.     /**
  24.      * @ORM\Column(type="datetime")
  25.      */
  26.     private $createdAt;
  27.     /**
  28.      * @ORM\OneToMany(targetEntity=Messaging::class, mappedBy="ticket")
  29.      */
  30.     private $messagings;
  31.     /**
  32.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="tickets")
  33.      * @ORM\JoinColumn(nullable=true)
  34.      * @Groups("post:read")
  35.      */
  36.     private $createdBy;
  37.     /**
  38.      * @ORM\Column(type="boolean")
  39.      */
  40.     private $isOpen;
  41.     /**
  42.      * @ORM\ManyToOne(targetEntity=Product::class)
  43.      * @ORM\JoinColumn(nullable=true)
  44.      */
  45.     private $product;
  46.     /**
  47.      * @ORM\Column(type="string", length=255)
  48.      * @Groups("post:read")
  49.      */
  50.     private $numero;
  51.     private $nbMessage;
  52.     /**
  53.      * @ORM\Column(type="integer", nullable=true)
  54.      */
  55.     private $DestinataireId;
  56.     /**
  57.      * @ORM\Column(type="string", length=255, nullable=true)
  58.      */
  59.     private $typeDestinataire;
  60.     /**
  61.      * @ORM\Column(type="integer", nullable=true)
  62.      */
  63.     private $expeditaireId;
  64.     /**
  65.      * @ORM\Column(type="string", length=20, nullable=true)
  66.      */
  67.     private $typeExpeditaire;
  68.     public function __construct()
  69.     {
  70.         $this->messagings = new ArrayCollection();
  71.         $this->createdAt = new \DateTime();
  72.         $this->isOpen true;
  73.     }
  74.     public function getId(): ?int
  75.     {
  76.         return $this->id;
  77.     }
  78.     public function getSubject(): ?string
  79.     {
  80.         return $this->subject;
  81.     }
  82.     public function setSubject(string $subject): self
  83.     {
  84.         $this->subject $subject;
  85.         return $this;
  86.     }
  87.     public function getCreatedAt(): ?\DateTimeInterface
  88.     {
  89.         return $this->createdAt;
  90.     }
  91.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  92.     {
  93.         $this->createdAt $createdAt;
  94.         return $this;
  95.     }
  96.     /**
  97.      * @return Collection|Messaging[]
  98.      */
  99.     public function getMessagings(): Collection
  100.     {
  101.         return $this->messagings;
  102.     }
  103.     public function addMessaging(Messaging $messaging): self
  104.     {
  105.         if (!$this->messagings->contains($messaging)) {
  106.             $this->messagings[] = $messaging;
  107.             $messaging->setTicket($this);
  108.         }
  109.         return $this;
  110.     }
  111.     public function removeMessaging(Messaging $messaging): self
  112.     {
  113.         if ($this->messagings->contains($messaging)) {
  114.             $this->messagings->removeElement($messaging);
  115.             // set the owning side to null (unless already changed)
  116.             if ($messaging->getTicket() === $this) {
  117.                 $messaging->setTicket(null);
  118.             }
  119.         }
  120.         return $this;
  121.     }
  122.     public function getCreatedBy(): ?User
  123.     {
  124.         return $this->createdBy;
  125.     }
  126.     public function setCreatedBy(?User $createdBy): self
  127.     {
  128.         $this->createdBy $createdBy;
  129.         return $this;
  130.     }
  131.     public function getIsOpen(): ?bool
  132.     {
  133.         return $this->isOpen;
  134.     }
  135.     public function setIsOpen(bool $isOpen): self
  136.     {
  137.         $this->isOpen $isOpen;
  138.         return $this;
  139.     }
  140.     public function getProduct(): ?Product
  141.     {
  142.         return $this->product;
  143.     }
  144.     public function setProduct(?Product $product): self
  145.     {
  146.         $this->product $product;
  147.         return $this;
  148.     }
  149.     public function getNumero(): ?string
  150.     {
  151.         return $this->numero;
  152.     }
  153.     public function setNumero(string $numero): self
  154.     {
  155.         $this->numero $numero;
  156.         return $this;
  157.     }
  158.     public function getNbMessage(): ?int
  159.     {
  160.         return $this->nbMessage;
  161.     }
  162.     public function setNbMessage(int $nbMessage): self
  163.     {
  164.         $this->nbMessage $nbMessage;
  165.         return $this;
  166.     }
  167.     public function getDestinataireId(): ?int
  168.     {
  169.         return $this->DestinataireId;
  170.     }
  171.     public function setDestinataireId(?int $DestinataireId): self
  172.     {
  173.         $this->DestinataireId $DestinataireId;
  174.         return $this;
  175.     }
  176.     public function getTypeDestinataire(): ?string
  177.     {
  178.         return $this->typeDestinataire;
  179.     }
  180.     public function setTypeDestinataire(?string $typeDestinataire): self
  181.     {
  182.         $this->typeDestinataire $typeDestinataire;
  183.         return $this;
  184.     }
  185.     public function getExpeditaireId(): ?int
  186.     {
  187.         return $this->expeditaireId;
  188.     }
  189.     public function setExpeditaireId(?int $expeditaireId): self
  190.     {
  191.         $this->expeditaireId $expeditaireId;
  192.         return $this;
  193.     }
  194.     public function getTypeExpeditaire(): ?string
  195.     {
  196.         return $this->typeExpeditaire;
  197.     }
  198.     public function setTypeExpeditaire(?string $typeExpeditaire): self
  199.     {
  200.         $this->typeExpeditaire $typeExpeditaire;
  201.         return $this;
  202.     }
  203.     
  204. }