WIP: feature_paste #1

Draft
Miroslavsckaya wants to merge 24 commits from feature_paste into master
2 changed files with 6 additions and 3 deletions
Showing only changes of commit 8bceb97550 - Show all commits

View file

@ -27,7 +27,7 @@ class PasteController extends AbstractController
$pasteData->ip = $request->getClientIp();
$paste = Paste::fromFormData($pasteData);
$pasteRepository->save($paste);
$pasteRepository->save($paste, true);
return $this->redirectToRoute($request->attributes->get('_route'));
}

View file

@ -14,10 +14,13 @@ class PasteRepository extends ServiceEntityRepository
parent::__construct($registry, Paste::class);
}
public function save(Paste $paste): void
public function save(Paste $paste, bool $flush=false): void
{
$entityManager = $this->getEntityManager();
$entityManager->persist($paste);
$entityManager->flush();
if ($flush) {
$entityManager->flush();
}
}
}