Fix relation and try to implement delete

This commit is contained in:
Tim 2025-04-28 11:24:28 +02:00
parent 683cd5074c
commit 6651aefc6b
2 changed files with 4 additions and 2 deletions

View File

@ -27,7 +27,7 @@ class Snip
#[ORM\OneToMany(mappedBy: 'snip', targetEntity: SnipContent::class, orphanRemoval: true)]
private Collection $snipContents;
#[ORM\ManyToOne]
#[ORM\OneToOne]
private ?SnipContent $activeVersion = null;
#[ORM\Column(length: 255)]

View File

@ -101,6 +101,8 @@ readonly class SnipContentService
public function delete(Snip $snip): void
{
// Cleanup the versions
foreach ($snip->getSnipContents() as $snipContent) {
$this->em->remove($snipContent);
}
}
}