Change snipConent entitie property to public

This commit is contained in:
Tim
2025-07-24 15:03:20 +02:00
parent 074c1d8570
commit a1ecaf0189
8 changed files with 40 additions and 136 deletions

View File

@@ -66,7 +66,7 @@ class Snip
{
if (!$this->snipContents->contains($snipContent)) {
$this->snipContents->add($snipContent);
$snipContent->setSnip($this);
$snipContent->snip = $this;
}
return $this;
@@ -76,8 +76,8 @@ class Snip
{
if ($this->snipContents->removeElement($snipContent)) {
// set the owning side to null (unless already changed)
if ($snipContent->getSnip() === $this) {
$snipContent->setSnip(null);
if ($snipContent->snip === $this) {
$snipContent->snip = null;
}
}

View File

@@ -17,124 +17,30 @@ class SnipContent
#[ORM\Column(type: UlidType::NAME, unique: true)]
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
#[ORM\CustomIdGenerator(class: 'doctrine.ulid_generator')]
private ?Ulid $id = null;
public ?Ulid $id = null;
#[ORM\ManyToOne(inversedBy: 'snipContents')]
#[ORM\JoinColumn(nullable: false)]
private ?Snip $snip = null;
public ?Snip $snip = null;
#[ORM\ManyToOne(targetEntity: self::class, inversedBy: 'children')]
private ?self $parent = null;
public ?self $parent = null;
#[ORM\OneToMany(mappedBy: 'parent', targetEntity: self::class)]
private Collection $children;
/** @var Collection<int, self> */
#[ORM\OneToMany(targetEntity: self::class, mappedBy: 'parent')]
public Collection $children;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $text = null;
public ?string $text = null;
#[ORM\Column(nullable: true)]
private ?array $diff = null;
public ?array $diff = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $name = null;
public ?string $name = null;
public function __construct()
{
$this->children = new ArrayCollection();
}
public function getId(): ?Ulid
{
return $this->id;
}
public function getSnip(): ?Snip
{
return $this->snip;
}
public function setSnip(?Snip $snip): self
{
$this->snip = $snip;
return $this;
}
public function getParent(): ?self
{
return $this->parent;
}
public function setParent(?self $parent): self
{
$this->parent = $parent;
return $this;
}
/**
* @return Collection<int, self>
*/
public function getChildren(): Collection
{
return $this->children;
}
public function addChild(self $child): self
{
if (!$this->children->contains($child)) {
$this->children->add($child);
$child->setParent($this);
}
return $this;
}
public function removeChild(self $child): self
{
if ($this->children->removeElement($child)) {
// set the owning side to null (unless already changed)
if ($child->getParent() === $this) {
$child->setParent(null);
}
}
return $this;
}
public function getText(): ?string
{
return $this->text;
}
public function setText(?string $text): self
{
$this->text = $text;
return $this;
}
public function getDiff(): ?array
{
return $this->diff;
}
public function setDiff(?array $diff): static
{
$this->diff = $diff;
return $this;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(?string $name): static
{
$this->name = $name;
return $this;
}
}