Fix relation and try to implement delete
This commit is contained in:
parent
683cd5074c
commit
6651aefc6b
@ -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)]
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user