cs: Fix code style (safe rules only).

This commit is contained in:
Pol Dellaiera
2021-11-23 14:06:38 +01:00
parent 149d7ce991
commit 8f96a1121d
1223 changed files with 65199 additions and 64625 deletions

View File

@@ -1,38 +1,27 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\MainBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Chill\MainBundle\Entity\Scope;
use Chill\MainBundle\Form\ScopeType;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\Request;
/**
* Class ScopeController
*
* @package Chill\MainBundle\Controller
* Class ScopeController.
*/
class ScopeController extends AbstractController
{
/**
* Lists all Scope entities.
*
*/
public function indexAction()
{
$em = $this->getDoctrine()->getManager();
$entities = $em->getRepository('ChillMainBundle:Scope')->findAll();
return $this->render('@ChillMain/Scope/index.html.twig', array(
'entities' => $entities,
));
}
/**
* Creates a new Scope entity.
*
*/
public function createAction(Request $request)
{
@@ -45,71 +34,19 @@ class ScopeController extends AbstractController
$em->persist($scope);
$em->flush();
return $this->redirect($this->generateUrl('admin_scope_show', array('id' => $scope->getId())));
return $this->redirect($this->generateUrl('admin_scope_show', ['id' => $scope->getId()]));
}
return $this->render('@ChillMain/Scope/new.html.twig', array(
return $this->render('@ChillMain/Scope/new.html.twig', [
'entity' => $scope,
'form' => $form->createView(),
));
}
/**
* Creates a form to create a Scope entity.
*
* @param Scope $scope The entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createCreateForm(Scope $scope)
{
$form = $this->createForm(ScopeType::class, $scope, array(
'action' => $this->generateUrl('admin_scope_create'),
'method' => 'POST',
));
$form->add('submit', SubmitType::class, array('label' => 'Create'));
return $form;
}
/**
* Displays a form to create a new Scope entity.
*
*/
public function newAction()
{
$scope = new Scope();
$form = $this->createCreateForm($scope);
return $this->render('@ChillMain/Scope/new.html.twig', array(
'entity' => $scope,
'form' => $form->createView(),
));
}
/**
* Finds and displays a Scope entity.
*
*/
public function showAction($id)
{
$em = $this->getDoctrine()->getManager();
$scope = $em->getRepository('ChillMainBundle:Scope')->find($id);
if (!$scope) {
throw $this->createNotFoundException('Unable to find Scope entity.');
}
return $this->render('@ChillMain/Scope/show.html.twig', array(
'entity' => $scope
));
'form' => $form->createView(),
]);
}
/**
* Displays a form to edit an existing Scope entity.
*
* @param mixed $id
*/
public function editAction($id)
{
@@ -123,33 +60,64 @@ class ScopeController extends AbstractController
$editForm = $this->createEditForm($scope);
return $this->render('@ChillMain/Scope/edit.html.twig', array(
'entity' => $scope,
'edit_form' => $editForm->createView(),
));
return $this->render('@ChillMain/Scope/edit.html.twig', [
'entity' => $scope,
'edit_form' => $editForm->createView(),
]);
}
/**
* Creates a form to edit a Scope entity.
*
* @param Scope $scope The entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createEditForm(Scope $scope)
* Lists all Scope entities.
*/
public function indexAction()
{
$form = $this->createForm(ScopeType::class, $scope, array(
'action' => $this->generateUrl('admin_scope_update', array('id' => $scope->getId())),
'method' => 'PUT',
));
$em = $this->getDoctrine()->getManager();
$form->add('submit', SubmitType::class, array('label' => 'Update'));
$entities = $em->getRepository('ChillMainBundle:Scope')->findAll();
return $form;
return $this->render('@ChillMain/Scope/index.html.twig', [
'entities' => $entities,
]);
}
/**
* Displays a form to create a new Scope entity.
*/
public function newAction()
{
$scope = new Scope();
$form = $this->createCreateForm($scope);
return $this->render('@ChillMain/Scope/new.html.twig', [
'entity' => $scope,
'form' => $form->createView(),
]);
}
/**
* Finds and displays a Scope entity.
*
* @param mixed $id
*/
public function showAction($id)
{
$em = $this->getDoctrine()->getManager();
$scope = $em->getRepository('ChillMainBundle:Scope')->find($id);
if (!$scope) {
throw $this->createNotFoundException('Unable to find Scope entity.');
}
return $this->render('@ChillMain/Scope/show.html.twig', [
'entity' => $scope,
]);
}
/**
* Edits an existing Scope entity.
*
* @param mixed $id
*/
public function updateAction(Request $request, $id)
{
@@ -167,12 +135,50 @@ class ScopeController extends AbstractController
if ($editForm->isValid()) {
$em->flush();
return $this->redirect($this->generateUrl('admin_scope_edit', array('id' => $id)));
return $this->redirect($this->generateUrl('admin_scope_edit', ['id' => $id]));
}
return $this->render('@ChillMain/Scope/edit.html.twig', array(
'entity' => $scope,
'edit_form' => $editForm->createView()
));
return $this->render('@ChillMain/Scope/edit.html.twig', [
'entity' => $scope,
'edit_form' => $editForm->createView(),
]);
}
/**
* Creates a form to create a Scope entity.
*
* @param Scope $scope The entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createCreateForm(Scope $scope)
{
$form = $this->createForm(ScopeType::class, $scope, [
'action' => $this->generateUrl('admin_scope_create'),
'method' => 'POST',
]);
$form->add('submit', SubmitType::class, ['label' => 'Create']);
return $form;
}
/**
* Creates a form to edit a Scope entity.
*
* @param Scope $scope The entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createEditForm(Scope $scope)
{
$form = $this->createForm(ScopeType::class, $scope, [
'action' => $this->generateUrl('admin_scope_update', ['id' => $scope->getId()]),
'method' => 'PUT',
]);
$form->add('submit', SubmitType::class, ['label' => 'Update']);
return $form;
}
}