Fix snip deletion
This commit is contained in:
parent
f52058c250
commit
06def04cae
@ -1,5 +1,5 @@
|
||||
{
|
||||
"dev": {
|
||||
"host": "http://snips.local.loken.nl"
|
||||
"host": "https://snips.localhost"
|
||||
}
|
||||
}
|
@ -139,7 +139,8 @@ class SnipController extends AbstractController
|
||||
$form = $this->createForm(ConfirmationType::class);
|
||||
$form->handleRequest($request);
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$this->contentService->delete($snip);
|
||||
$snip->setActiveVersion(null);
|
||||
$this->repository->save($snip);
|
||||
$this->repository->remove($snip);
|
||||
$this->addFlash('success', sprintf('Snip "%s" deleted', $snip));
|
||||
return $this->redirectToRoute('snip_index');
|
||||
|
@ -98,11 +98,4 @@ readonly class SnipContentService
|
||||
$this->em->persist($content);
|
||||
$this->em->flush();
|
||||
}
|
||||
|
||||
public function delete(Snip $snip): void
|
||||
{
|
||||
foreach ($snip->getSnipContents() as $snipContent) {
|
||||
$this->em->remove($snipContent);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user