save method in PasteRepository changed
This commit is contained in:
parent
ddfbba344a
commit
8bceb97550
|
@ -27,7 +27,7 @@ class PasteController extends AbstractController
|
||||||
$pasteData->ip = $request->getClientIp();
|
$pasteData->ip = $request->getClientIp();
|
||||||
|
|
||||||
$paste = Paste::fromFormData($pasteData);
|
$paste = Paste::fromFormData($pasteData);
|
||||||
$pasteRepository->save($paste);
|
$pasteRepository->save($paste, true);
|
||||||
|
|
||||||
return $this->redirectToRoute($request->attributes->get('_route'));
|
return $this->redirectToRoute($request->attributes->get('_route'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,10 +14,13 @@ class PasteRepository extends ServiceEntityRepository
|
||||||
parent::__construct($registry, Paste::class);
|
parent::__construct($registry, Paste::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function save(Paste $paste): void
|
public function save(Paste $paste, bool $flush=false): void
|
||||||
{
|
{
|
||||||
$entityManager = $this->getEntityManager();
|
$entityManager = $this->getEntityManager();
|
||||||
$entityManager->persist($paste);
|
$entityManager->persist($paste);
|
||||||
|
|
||||||
|
if ($flush) {
|
||||||
$entityManager->flush();
|
$entityManager->flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue