Skip to content

Commit 570f001

Browse files
committed
minor #317 [CRUD] Remove abbreviation in var name $em (ckrack)
This PR was merged into the 1.0-dev branch. Discussion ---------- [CRUD] Remove abbreviation in var name $em As stated by @kunicmarco20 [here](symfony/symfony-docs#10588 (review)), no abbreviations should be used in var names. This PR fixes this in the generated Controller for `make:crud` Commits ------- 8176d83 Remove abbreviation in var name $em
2 parents ab54d92 + 8176d83 commit 570f001

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/Resources/skeleton/crud/controller/Controller.tpl.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ public function new(Request $request): Response
4646
$form->handleRequest($request);
4747

4848
if ($form->isSubmitted() && $form->isValid()) {
49-
$em = $this->getDoctrine()->getManager();
50-
$em->persist($<?= $entity_var_singular ?>);
51-
$em->flush();
49+
$entityManager = $this->getDoctrine()->getManager();
50+
$entityManager->persist($<?= $entity_var_singular ?>);
51+
$entityManager->flush();
5252

5353
return $this->redirectToRoute('<?= $route_name ?>_index');
5454
}
@@ -93,9 +93,9 @@ public function edit(Request $request, <?= $entity_class_name ?> $<?= $entity_va
9393
public function delete(Request $request, <?= $entity_class_name ?> $<?= $entity_var_singular ?>): Response
9494
{
9595
if ($this->isCsrfTokenValid('delete'.$<?= $entity_var_singular ?>->get<?= ucfirst($entity_identifier) ?>(), $request->request->get('_token'))) {
96-
$em = $this->getDoctrine()->getManager();
97-
$em->remove($<?= $entity_var_singular ?>);
98-
$em->flush();
96+
$entityManager = $this->getDoctrine()->getManager();
97+
$entityManager->remove($<?= $entity_var_singular ?>);
98+
$entityManager->flush();
9999
}
100100

101101
return $this->redirectToRoute('<?= $route_name ?>_index');

0 commit comments

Comments
 (0)