diff --git a/src/Entity/ClientTicket.php b/src/Entity/ClientTicket.php new file mode 100644 index 0000000..ac7d5db --- /dev/null +++ b/src/Entity/ClientTicket.php @@ -0,0 +1,261 @@ + ['client_ticket:read']], + denormalizationContext: ['groups' => ['client_ticket:write']], + order: ['createdAt' => 'DESC'], +)] +#[ORM\Entity(repositoryClass: ClientTicketRepository::class)] +#[ORM\Table( + name: 'client_ticket', + uniqueConstraints: [ + new ORM\UniqueConstraint(name: 'uniq_client_ticket_project_number', columns: ['project_id', 'number']), + ], +)] +class ClientTicket +{ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column] + #[Groups(['client_ticket:read', 'task:read'])] + private ?int $id = null; + + #[ORM\Column(type: 'integer')] + #[Groups(['client_ticket:read', 'task:read'])] + private ?int $number = null; + + #[ORM\Column(length: 20)] + #[Groups(['client_ticket:read', 'client_ticket:write', 'task:read'])] + private ?string $type = null; + + #[ORM\Column(length: 255)] + #[Groups(['client_ticket:read', 'client_ticket:write', 'task:read'])] + private ?string $title = null; + + #[ORM\Column(type: 'text')] + #[Groups(['client_ticket:read', 'client_ticket:write'])] + private ?string $description = null; + + #[ORM\Column(length: 255, nullable: true)] + #[Groups(['client_ticket:read', 'client_ticket:write'])] + private ?string $url = null; + + #[ORM\Column(length: 20)] + #[Groups(['client_ticket:read', 'client_ticket:write', 'task:read'])] + private ?string $status = 'new'; + + #[ORM\Column(type: 'text', nullable: true)] + #[Groups(['client_ticket:read', 'client_ticket:write'])] + private ?string $statusComment = null; + + #[ORM\ManyToOne(targetEntity: Project::class)] + #[ORM\JoinColumn(nullable: false, onDelete: 'CASCADE')] + #[Groups(['client_ticket:read', 'client_ticket:write'])] + private ?Project $project = null; + + #[ORM\ManyToOne(targetEntity: User::class)] + #[ORM\JoinColumn(nullable: true, onDelete: 'SET NULL')] + #[Groups(['client_ticket:read'])] + private ?User $submittedBy = null; + + /** @var Collection */ + #[ORM\OneToMany(targetEntity: TaskDocument::class, mappedBy: 'clientTicket', cascade: ['remove'])] + #[Groups(['client_ticket:read'])] + private Collection $documents; + + #[ORM\Column(type: 'datetime_immutable')] + #[Groups(['client_ticket:read'])] + private ?DateTimeImmutable $createdAt = null; + + #[ORM\Column(type: 'datetime_immutable')] + #[Groups(['client_ticket:read'])] + private ?DateTimeImmutable $updatedAt = null; + + public function __construct() + { + $this->documents = new ArrayCollection(); + } + + public function getId(): ?int + { + return $this->id; + } + + public function getNumber(): ?int + { + return $this->number; + } + + public function setNumber(int $number): static + { + $this->number = $number; + + return $this; + } + + public function getType(): ?string + { + return $this->type; + } + + public function setType(string $type): static + { + $this->type = $type; + + return $this; + } + + public function getTitle(): ?string + { + return $this->title; + } + + public function setTitle(string $title): static + { + $this->title = $title; + + return $this; + } + + public function getDescription(): ?string + { + return $this->description; + } + + public function setDescription(string $description): static + { + $this->description = $description; + + return $this; + } + + public function getUrl(): ?string + { + return $this->url; + } + + public function setUrl(?string $url): static + { + $this->url = $url; + + return $this; + } + + public function getStatus(): ?string + { + return $this->status; + } + + public function setStatus(string $status): static + { + $this->status = $status; + + return $this; + } + + public function getStatusComment(): ?string + { + return $this->statusComment; + } + + public function setStatusComment(?string $statusComment): static + { + $this->statusComment = $statusComment; + + return $this; + } + + public function getProject(): ?Project + { + return $this->project; + } + + public function setProject(?Project $project): static + { + $this->project = $project; + + return $this; + } + + public function getSubmittedBy(): ?User + { + return $this->submittedBy; + } + + public function setSubmittedBy(?User $submittedBy): static + { + $this->submittedBy = $submittedBy; + + return $this; + } + + /** @return Collection */ + public function getDocuments(): Collection + { + return $this->documents; + } + + public function getCreatedAt(): ?DateTimeImmutable + { + return $this->createdAt; + } + + public function setCreatedAt(DateTimeImmutable $createdAt): static + { + $this->createdAt = $createdAt; + + return $this; + } + + public function getUpdatedAt(): ?DateTimeImmutable + { + return $this->updatedAt; + } + + public function setUpdatedAt(DateTimeImmutable $updatedAt): static + { + $this->updatedAt = $updatedAt; + + return $this; + } +}