add tagging

This commit is contained in:
team 1
2026-02-21 16:23:34 +01:00
parent 5a3852db12
commit cf5b473034
23 changed files with 1984 additions and 85 deletions

82
src/Entity/Tag.php Normal file
View File

@@ -0,0 +1,82 @@
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Uid\Uuid;
#[ORM\Entity]
#[ORM\Table(name: 'knowledge_tag')]
#[ORM\Index(name: 'idx_knowledge_tag_slug', columns: ['slug'])]
#[ORM\Index(name: 'idx_knowledge_tag_label', columns: ['label'])]
class Tag
{
#[ORM\Id]
#[ORM\Column(type: 'uuid', unique: true)]
private Uuid $id;
#[ORM\Column(length: 120, unique: true)]
private string $slug;
#[ORM\Column(length: 180)]
private string $label;
#[ORM\Column(type: 'text', nullable: true)]
private ?string $description = null;
#[ORM\Column]
private \DateTimeImmutable $createdAt;
public function __construct(string $slug, string $label, ?string $description = null)
{
$this->id = Uuid::v4();
$this->createdAt = new \DateTimeImmutable();
$this->slug = $slug;
$this->label = $label;
$this->description = $description;
}
public function getId(): Uuid
{
return $this->id;
}
public function getSlug(): string
{
return $this->slug;
}
public function setSlug(string $slug): static
{
$this->slug = $slug;
return $this;
}
public function getLabel(): string
{
return $this->label;
}
public function setLabel(string $label): static
{
$this->label = $label;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): static
{
$this->description = $description;
return $this;
}
public function getCreatedAt(): \DateTimeImmutable
{
return $this->createdAt;
}
}