refactor : rename TaskType to TaskTag across the stack

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Matthieu
2026-03-13 08:20:21 +01:00
parent dbae1f7536
commit 56275a9ebe
16 changed files with 216 additions and 117 deletions

View File

@@ -41,7 +41,7 @@ use Symfony\Component\Serializer\Attribute\Groups;
denormalizationContext: ['groups' => ['time_entry:write']],
order: ['startedAt' => 'DESC'],
)]
#[ApiFilter(SearchFilter::class, properties: ['user' => 'exact', 'project' => 'exact', 'types' => 'exact'])]
#[ApiFilter(SearchFilter::class, properties: ['user' => 'exact', 'project' => 'exact', 'tags' => 'exact'])]
#[ApiFilter(DateFilter::class, properties: ['startedAt'])]
#[ORM\Entity(repositoryClass: TimeEntryRepository::class)]
#[ORM\UniqueConstraint(name: 'uniq_active_timer', columns: ['user_id'], options: ['where' => '(stopped_at IS NULL)'])]
@@ -84,15 +84,19 @@ class TimeEntry
#[Groups(['time_entry:read', 'time_entry:write'])]
private ?Task $task = null;
/** @var Collection<int, TaskType> */
#[ORM\ManyToMany(targetEntity: TaskType::class)]
#[ORM\JoinTable(name: 'time_entry_task_type')]
/** @var Collection<int, TaskTag> */
#[ORM\ManyToMany(targetEntity: TaskTag::class)]
#[ORM\JoinTable(
name: 'time_entry_task_type',
joinColumns: [new ORM\JoinColumn(name: 'time_entry_id', referencedColumnName: 'id')],
inverseJoinColumns: [new ORM\JoinColumn(name: 'task_type_id', referencedColumnName: 'id')],
)]
#[Groups(['time_entry:read', 'time_entry:write'])]
private Collection $types;
private Collection $tags;
public function __construct()
{
$this->types = new ArrayCollection();
$this->tags = new ArrayCollection();
}
public function getId(): ?int
@@ -184,24 +188,24 @@ class TimeEntry
return $this;
}
/** @return Collection<int, TaskType> */
public function getTypes(): Collection
/** @return Collection<int, TaskTag> */
public function getTags(): Collection
{
return $this->types;
return $this->tags;
}
public function addType(TaskType $type): static
public function addTag(TaskTag $tag): static
{
if (!$this->types->contains($type)) {
$this->types->add($type);
if (!$this->tags->contains($tag)) {
$this->tags->add($tag);
}
return $this;
}
public function removeType(TaskType $type): static
public function removeTag(TaskTag $tag): static
{
$this->types->removeElement($type);
$this->tags->removeElement($tag);
return $this;
}