Change snip and tag entities to public columns

This commit is contained in:
Tim
2025-07-24 14:51:55 +02:00
parent 8226ac24d8
commit 074c1d8570
15 changed files with 70 additions and 225 deletions

View File

@ -17,34 +17,34 @@ class Snip
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
public ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $name = null;
public ?string $name = null;
#[ORM\Column]
private bool $public = false;
public bool $public = false;
#[ORM\OneToMany(mappedBy: 'snip', targetEntity: SnipContent::class, orphanRemoval: true)]
private Collection $snipContents;
public Collection $snipContents;
#[ORM\OneToOne]
private ?SnipContent $activeVersion = null;
public ?SnipContent $activeVersion = null;
#[ORM\Column(length: 255)]
private ?string $parser = null;
public ?string $parser = null;
#[ORM\Column]
private bool $visible = true;
public bool $visible = true;
#[ORM\Column]
private bool $archived = false;
public bool $archived = false;
/**
* @var Collection<int, Tag>
*/
#[ORM\ManyToMany(targetEntity: Tag::class, mappedBy: 'snips')]
private Collection $tags;
public Collection $tags;
public function __construct()
{
@ -59,44 +59,7 @@ class Snip
public function getActiveText(): string
{
return SnipContentService::rebuildText($this->getActiveVersion());
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function isPublic(): ?bool
{
return $this->public;
}
public function setPublic(bool $public): self
{
$this->public = $public;
return $this;
}
/**
* @return Collection<int, SnipContent>
*/
public function getSnipContents(): Collection
{
return $this->snipContents;
return SnipContentService::rebuildText($this->activeVersion);
}
public function addSnipContent(SnipContent $snipContent): self
@ -126,62 +89,6 @@ class Snip
return $this->snipContents->last() ?: null;
}
public function getActiveVersion(): ?SnipContent
{
return $this->activeVersion;
}
public function setActiveVersion(?SnipContent $activeVersion): static
{
$this->activeVersion = $activeVersion;
return $this;
}
public function getParser(): ?string
{
return $this->parser;
}
public function setParser(string $parser): static
{
$this->parser = $parser;
return $this;
}
public function isVisible(): ?bool
{
return $this->visible;
}
public function setVisible(bool $visible): static
{
$this->visible = $visible;
return $this;
}
public function isArchived(): ?bool
{
return $this->archived;
}
public function setArchived(bool $archived): static
{
$this->archived = $archived;
return $this;
}
/**
* @return Collection<int, Tag>
*/
public function getTags(): Collection
{
return $this->tags;
}
public function addTag(Tag $tag): static
{
if (!$this->tags->contains($tag)) {