Integrate snipContent more tightly into snip and cleanup old code

This commit is contained in:
Tim
2023-12-20 22:37:06 +01:00
parent 64bd7e3642
commit 5624fc3a74
9 changed files with 67 additions and 45 deletions

View File

@ -21,12 +21,9 @@ class VersionController extends AbstractController
public function index(Snip $snip): Response
{
$this->denyAccessUnlessGranted(SnipVoter::EDIT, $snip);
$snipService = $this->snipServiceFactory->create($snip);
return $this->render('version/index.html.twig', [
'snip' => $snip,
'versions' => $snipService->getVersions(),
'latestVersion' => $snipService->getLatestVersion(),
]);
}
@ -35,7 +32,7 @@ class VersionController extends AbstractController
{
$this->denyAccessUnlessGranted(SnipVoter::EDIT, $snip);
$this->snipServiceFactory->create($snip)->setVersion($version->getId());
$this->snipServiceFactory->create($snip)->setVersion($version);
$this->addFlash('success', 'Snip version set to ' . $version->getId());
return $this->redirectToRoute('snip_single', ['snip' => $snip->getId()]);
}