mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-22 01:49:05 +02:00
Dont call translator inside the form classes.
Translation is already done in the templates, so translator calls in form classes, are bad for performance and readability.
This commit is contained in:
parent
e7b920c4fe
commit
89acfff857
28 changed files with 1875 additions and 2259 deletions
|
@ -97,11 +97,11 @@ class PartController extends AbstractController
|
|||
|
||||
$em->persist($part);
|
||||
$em->flush();
|
||||
$this->addFlash('info', $translator->trans('part.edited_flash'));
|
||||
$this->addFlash('info', 'part.edited_flash');
|
||||
//Reload form, so the SIUnitType entries use the new part unit
|
||||
$form = $this->createForm(PartBaseType::class, $part);
|
||||
} elseif ($form->isSubmitted() && !$form->isValid()) {
|
||||
$this->addFlash('error', $translator->trans('part.edited_flash.invalid'));
|
||||
$this->addFlash('error', 'part.edited_flash.invalid');
|
||||
}
|
||||
|
||||
return $this->render('Parts/edit/edit_part_info.html.twig',
|
||||
|
@ -180,13 +180,13 @@ class PartController extends AbstractController
|
|||
|
||||
$em->persist($new_part);
|
||||
$em->flush();
|
||||
$this->addFlash('success', $translator->trans('part.created_flash'));
|
||||
$this->addFlash('success', 'part.created_flash');
|
||||
|
||||
return $this->redirectToRoute('part_edit', ['id' => $new_part->getID()]);
|
||||
}
|
||||
|
||||
if ($form->isSubmitted() && !$form->isValid()) {
|
||||
$this->addFlash('error', $translator->trans('part.created_flash.invalid'));
|
||||
$this->addFlash('error', 'part.created_flash.invalid');
|
||||
}
|
||||
|
||||
return $this->render('Parts/edit/new_part.html.twig',
|
||||
|
@ -216,7 +216,7 @@ class PartController extends AbstractController
|
|||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$em->persist($new_part);
|
||||
$em->flush();
|
||||
$this->addFlash('success', $translator->trans('part.created_flash'));
|
||||
$this->addFlash('success', 'part.created_flash');
|
||||
|
||||
return $this->redirectToRoute('part_edit', ['id' => $new_part->getID()]);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue