Start on creating snipContent entities for the db content
This commit is contained in:
@ -25,7 +25,7 @@ class HistoryController extends AbstractController
|
||||
|
||||
return $this->render('history/index.html.twig', [
|
||||
'snip' => $snip,
|
||||
'commits' => $this->snipServiceFactory->create($snip)->getHistory(),
|
||||
'commits' => $this->snipServiceFactory->createGit($snip)->getHistory(),
|
||||
]);
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@ class HistoryController extends AbstractController
|
||||
{
|
||||
$this->denyAccessUnlessGranted(SnipVoter::EDIT, $snip);
|
||||
|
||||
$this->snipServiceFactory->create($snip)->setCommit($commit);
|
||||
$this->snipServiceFactory->createGit($snip)->setCommit($commit);
|
||||
$this->addFlash('success', 'Snip version set to ' . $commit);
|
||||
return $this->redirectToRoute('snip_single', ['snip' => $snip->getId()]);
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ class SnipController extends AbstractController
|
||||
{
|
||||
$this->denyAccessUnlessGranted(SnipVoter::VIEW, $snip);
|
||||
|
||||
$snipService = $this->snipServiceFactory->create($snip);
|
||||
$snipService = $this->snipServiceFactory->createGit($snip);
|
||||
return $this->render('snip/single.html.twig', [
|
||||
'snip' => $snip,
|
||||
'content' => (new Pipeline())->parse($snipService->get()),
|
||||
@ -62,7 +62,7 @@ class SnipController extends AbstractController
|
||||
$this->denyAccessUnlessGranted(SnipVoter::VIEW, $snip);
|
||||
|
||||
$response = new Response(
|
||||
(new Pipeline())->clean($this->snipServiceFactory->create($snip)->get()),
|
||||
(new Pipeline())->clean($this->snipServiceFactory->createGit($snip)->get()),
|
||||
Response::HTTP_OK,
|
||||
['Content-Type' => 'text/html']
|
||||
);
|
||||
@ -91,13 +91,13 @@ class SnipController extends AbstractController
|
||||
$form = $this->createForm(SnipType::class, $snip);
|
||||
$form->add('Save', SubmitType::class);
|
||||
if ($snip->getId()) {
|
||||
$form->get('content')->setData($this->snipServiceFactory->create($snip)->get());
|
||||
$form->get('content')->setData($this->snipServiceFactory->createGit($snip)->get());
|
||||
}
|
||||
|
||||
$form->handleRequest($request);
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$this->repository->save($snip);
|
||||
$this->snipServiceFactory->create($snip)->update($form->get('content')->getData());
|
||||
$this->snipServiceFactory->createGit($snip)->update($form->get('content')->getData());
|
||||
|
||||
$this->addFlash('success', sprintf('Snip "%s" saved', $snip));
|
||||
|
||||
@ -130,7 +130,7 @@ class SnipController extends AbstractController
|
||||
$form = $this->createForm(ConfirmationType::class);
|
||||
$form->handleRequest($request);
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$this->snipServiceFactory->create($snip)->delete();
|
||||
$this->snipServiceFactory->createGit($snip)->delete();
|
||||
$this->repository->remove($snip);
|
||||
$this->addFlash('success', sprintf('Snip "%s" deleted', $snip));
|
||||
return $this->redirectToRoute('snip_index');
|
||||
|
Reference in New Issue
Block a user