*/ #[ORM\ManyToMany(targetEntity: Tag::class, inversedBy: 'projects')] private Collection $tags; /** * @var Collection */ #[ORM\OneToMany(targetEntity: Task::class, mappedBy: 'project', orphanRemoval: true)] private Collection $tasks; #[ORM\ManyToOne(inversedBy: 'projects')] #[ORM\JoinColumn(nullable: false)] private ?User $createdBy = null; #[ORM\Column] #[Gedmo\Timestampable(on: 'create')] private ?\DateTimeImmutable $createdAt = null; public function __construct() { $this->tags = new ArrayCollection(); $this->tasks = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getName(): ?string { return $this->name; } public function setName(string $name): static { $this->name = $name; return $this; } public function getDescription(): ?string { return $this->description; } public function setDescription(?string $description): static { $this->description = $description; return $this; } public function getSlug(): ?string { return $this->slug; } /** * @return Collection */ public function getTags(): Collection { return $this->tags; } public function addTag(Tag $tag): static { if (!$this->tags->contains($tag)) { $this->tags->add($tag); } return $this; } public function removeTag(Tag $tag): static { $this->tags->removeElement($tag); return $this; } /** * @return Collection */ public function getTasks(): Collection { return $this->tasks; } public function addTask(Task $task): static { if (!$this->tasks->contains($task)) { $this->tasks->add($task); $task->setProject($this); } return $this; } public function removeTask(Task $task): static { if ($this->tasks->removeElement($task)) { // set the owning side to null (unless already changed) if ($task->getProject() === $this) { $task->setProject(null); } } return $this; } public function getCreatedBy(): ?User { return $this->createdBy; } public function setCreatedBy(?User $createdBy): static { $this->createdBy = $createdBy; return $this; } public function getCreatedAt(): ?\DateTimeImmutable { return $this->createdAt; } public function setCreatedAt(\DateTimeImmutable $createdAt): static { $this->createdAt = $createdAt; return $this; } }