forked from audrey/intranet
385 lines
8.8 KiB
PHP
385 lines
8.8 KiB
PHP
<?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;
|
|
|
|
#[ORM\Entity(repositoryClass: TicketRepository::class)]
|
|
class Ticket
|
|
{
|
|
#[ORM\Id]
|
|
#[ORM\GeneratedValue]
|
|
#[ORM\Column]
|
|
private ?int $id = null;
|
|
|
|
#[ORM\Column(length: 255)]
|
|
private ?string $summary = null;
|
|
|
|
#[ORM\Column(length: 255)]
|
|
private ?string $status = null;
|
|
|
|
#[ORM\Column(length: 255, nullable: true)]
|
|
private ?string $description = null;
|
|
|
|
#[ORM\Column(nullable: true)]
|
|
private ?int $priority = null;
|
|
|
|
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
|
|
private ?\DateTimeInterface $createdAt = null;
|
|
|
|
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
|
|
private ?\DateTimeInterface $updatedAt = null;
|
|
|
|
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
|
|
private ?\DateTimeInterface $closedAt = null;
|
|
|
|
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
|
|
private ?\DateTimeInterface $viewedAt = null;
|
|
|
|
#[ORM\Column(nullable: true)]
|
|
private ?bool $reopened = null;
|
|
|
|
#[ORM\Column(length: 255, nullable: true)]
|
|
private ?string $category = null;
|
|
|
|
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
|
|
private ?\DateTimeInterface $statusUpdatedAt = null;
|
|
|
|
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
|
|
private ?\DateTimeInterface $dueAt = null;
|
|
|
|
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
|
|
private ?\DateTimeInterface $syncedAt = null;
|
|
|
|
#[ORM\Column(nullable: true)]
|
|
private ?int $firstResponseSecs = null;
|
|
|
|
#[ORM\ManyToOne(inversedBy: 'ticketsCreated')]
|
|
private ?User $createdBy = null;
|
|
|
|
#[ORM\ManyToOne(inversedBy: 'ticketsAssigned')]
|
|
private ?User $assignedTo = null;
|
|
|
|
#[ORM\ManyToOne(targetEntity: self::class, inversedBy: 'childTickets')]
|
|
private ?self $masterTicket = null;
|
|
|
|
#[ORM\OneToMany(mappedBy: 'masterTicket', targetEntity: self::class)]
|
|
private Collection $childTickets;
|
|
|
|
#[ORM\OneToMany(mappedBy: 'ticket', targetEntity: Comment::class)]
|
|
private Collection $comments;
|
|
|
|
#[ORM\OneToMany(mappedBy: 'ticket', targetEntity: TicketInvolvements::class)]
|
|
private Collection $contributors;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->childTickets = new ArrayCollection();
|
|
$this->comments = new ArrayCollection();
|
|
$this->contributors = new ArrayCollection();
|
|
}
|
|
|
|
public function getId(): ?int
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function getSummary(): ?string
|
|
{
|
|
return $this->summary;
|
|
}
|
|
|
|
public function setSummary(string $summary): static
|
|
{
|
|
$this->summary = $summary;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getStatus(): ?string
|
|
{
|
|
return $this->status;
|
|
}
|
|
|
|
public function setStatus(string $status): static
|
|
{
|
|
$this->status = $status;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getDescription(): ?string
|
|
{
|
|
return $this->description;
|
|
}
|
|
|
|
public function setDescription(?string $description): static
|
|
{
|
|
$this->description = $description;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getPriority(): ?int
|
|
{
|
|
return $this->priority;
|
|
}
|
|
|
|
public function setPriority(?int $priority): static
|
|
{
|
|
$this->priority = $priority;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getCreatedAt(): ?\DateTimeInterface
|
|
{
|
|
return $this->createdAt;
|
|
}
|
|
|
|
public function setCreatedAt(?\DateTimeInterface $createdAt): static
|
|
{
|
|
$this->createdAt = $createdAt;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getUpdatedAt(): ?\DateTimeInterface
|
|
{
|
|
return $this->updatedAt;
|
|
}
|
|
|
|
public function setUpdatedAt(?\DateTimeInterface $updatedAt): static
|
|
{
|
|
$this->updatedAt = $updatedAt;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getClosedAt(): ?\DateTimeInterface
|
|
{
|
|
return $this->closedAt;
|
|
}
|
|
|
|
public function setClosedAt(?\DateTimeInterface $closedAt): static
|
|
{
|
|
$this->closedAt = $closedAt;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getViewedAt(): ?\DateTimeInterface
|
|
{
|
|
return $this->viewedAt;
|
|
}
|
|
|
|
public function setViewedAt(?\DateTimeInterface $viewedAt): static
|
|
{
|
|
$this->viewedAt = $viewedAt;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function isReopened(): ?bool
|
|
{
|
|
return $this->reopened;
|
|
}
|
|
|
|
public function setReopened(?bool $reopened): static
|
|
{
|
|
$this->reopened = $reopened;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getCategory(): ?string
|
|
{
|
|
return $this->category;
|
|
}
|
|
|
|
public function setCategory(?string $category): static
|
|
{
|
|
$this->category = $category;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getStatusUpdatedAt(): ?\DateTimeInterface
|
|
{
|
|
return $this->statusUpdatedAt;
|
|
}
|
|
|
|
public function setStatusUpdatedAt(?\DateTimeInterface $statusUpdatedAt): static
|
|
{
|
|
$this->statusUpdatedAt = $statusUpdatedAt;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getDueAt(): ?\DateTimeInterface
|
|
{
|
|
return $this->dueAt;
|
|
}
|
|
|
|
public function setDueAt(?\DateTimeInterface $dueAt): static
|
|
{
|
|
$this->dueAt = $dueAt;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getSyncedAt(): ?\DateTimeInterface
|
|
{
|
|
return $this->syncedAt;
|
|
}
|
|
|
|
public function setSyncedAt(?\DateTimeInterface $syncedAt): static
|
|
{
|
|
$this->syncedAt = $syncedAt;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getFirstResponseSecs(): ?int
|
|
{
|
|
return $this->firstResponseSecs;
|
|
}
|
|
|
|
public function setFirstResponseSecs(?int $firstResponseSecs): static
|
|
{
|
|
$this->firstResponseSecs = $firstResponseSecs;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getCreatedBy(): ?User
|
|
{
|
|
return $this->createdBy;
|
|
}
|
|
|
|
public function setCreatedBy(?User $createdBy): static
|
|
{
|
|
$this->createdBy = $createdBy;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getAssignedTo(): ?User
|
|
{
|
|
return $this->assignedTo;
|
|
}
|
|
|
|
public function setAssignedTo(?User $assignedTo): static
|
|
{
|
|
$this->assignedTo = $assignedTo;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getMasterTicket(): ?self
|
|
{
|
|
return $this->masterTicket;
|
|
}
|
|
|
|
public function setMasterTicket(?self $masterTicket): static
|
|
{
|
|
$this->masterTicket = $masterTicket;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return Collection<int, self>
|
|
*/
|
|
public function getChildTickets(): Collection
|
|
{
|
|
return $this->childTickets;
|
|
}
|
|
|
|
public function addChildTicket(self $childTicket): static
|
|
{
|
|
if (!$this->childTickets->contains($childTicket)) {
|
|
$this->childTickets->add($childTicket);
|
|
$childTicket->setMasterTicket($this);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function removeChildTicket(self $childTicket): static
|
|
{
|
|
if ($this->childTickets->removeElement($childTicket)) {
|
|
// set the owning side to null (unless already changed)
|
|
if ($childTicket->getMasterTicket() === $this) {
|
|
$childTicket->setMasterTicket(null);
|
|
}
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return Collection<int, Comment>
|
|
*/
|
|
public function getComments(): Collection
|
|
{
|
|
return $this->comments;
|
|
}
|
|
|
|
public function addComment(Comment $comment): static
|
|
{
|
|
if (!$this->comments->contains($comment)) {
|
|
$this->comments->add($comment);
|
|
$comment->setTicket($this);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function removeComment(Comment $comment): static
|
|
{
|
|
if ($this->comments->removeElement($comment)) {
|
|
// set the owning side to null (unless already changed)
|
|
if ($comment->getTicket() === $this) {
|
|
$comment->setTicket(null);
|
|
}
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return Collection<int, TicketInvolvements>
|
|
*/
|
|
public function getContributors(): Collection
|
|
{
|
|
return $this->contributors;
|
|
}
|
|
|
|
public function addContributor(TicketInvolvements $contributor): static
|
|
{
|
|
if (!$this->contributors->contains($contributor)) {
|
|
$this->contributors->add($contributor);
|
|
$contributor->setTicket($this);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function removeContributor(TicketInvolvements $contributor): static
|
|
{
|
|
if ($this->contributors->removeElement($contributor)) {
|
|
// set the owning side to null (unless already changed)
|
|
if ($contributor->getTicket() === $this) {
|
|
$contributor->setTicket(null);
|
|
}
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
}
|