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,39 +1,28 @@
<?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\EventBundle\Controller;
use Chill\EventBundle\Entity\Status;
use Chill\EventBundle\Form\StatusType;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\Request;
use Chill\EventBundle\Entity\Status;
use Chill\EventBundle\Form\StatusType;
/**
* Class StatusController
*
* @package Chill\EventBundle\Controller
* Class StatusController.
*/
class StatusController extends AbstractController
{
/**
* Lists all Status entities.
*
*/
public function indexAction()
{
$em = $this->getDoctrine()->getManager();
$entities = $em->getRepository('ChillEventBundle:Status')->findAll();
return $this->render('ChillEventBundle:Status:index.html.twig', array(
'entities' => $entities,
));
}
/**
* Creates a new Status entity.
*
*/
public function createAction(Request $request)
{
@@ -46,146 +35,19 @@ class StatusController extends AbstractController
$em->persist($entity);
$em->flush();
return $this->redirect($this->generateUrl('chill_event_admin_status', array('id' => $entity->getId())));
return $this->redirect($this->generateUrl('chill_event_admin_status', ['id' => $entity->getId()]));
}
return $this->render('ChillEventBundle:Status:new.html.twig', array(
return $this->render('ChillEventBundle:Status:new.html.twig', [
'entity' => $entity,
'form' => $form->createView(),
));
'form' => $form->createView(),
]);
}
/**
* Creates a form to create a Status entity.
*
* @param Status $entity The entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createCreateForm(Status $entity)
{
$form = $this->createForm(StatusType::class, $entity, array(
'action' => $this->generateUrl('chill_event_admin_status_create'),
'method' => 'POST',
));
$form->add('submit', SubmitType::class, array('label' => 'Create'));
return $form;
}
/**
* Displays a form to create a new Status entity.
*
*/
public function newAction()
{
$entity = new Status();
$form = $this->createCreateForm($entity);
return $this->render('ChillEventBundle:Status:new.html.twig', array(
'entity' => $entity,
'form' => $form->createView(),
));
}
/**
* Finds and displays a Status entity.
*
*/
public function showAction($id)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('ChillEventBundle:Status')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Status entity.');
}
$deleteForm = $this->createDeleteForm($id);
return $this->render('ChillEventBundle:Status:show.html.twig', array(
'entity' => $entity,
'delete_form' => $deleteForm->createView(),
));
}
/**
* Displays a form to edit an existing Status entity.
*
*/
public function editAction($id)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('ChillEventBundle:Status')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Status entity.');
}
$editForm = $this->createEditForm($entity);
$deleteForm = $this->createDeleteForm($id);
return $this->render('ChillEventBundle:Status:edit.html.twig', array(
'entity' => $entity,
'edit_form' => $editForm->createView(),
'delete_form' => $deleteForm->createView(),
));
}
/**
* Creates a form to edit a Status entity.
*
* @param Status $entity The entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createEditForm(Status $entity)
{
$form = $this->createForm(StatusType::class, $entity, array(
'action' => $this->generateUrl('chill_event_admin_status_update', array('id' => $entity->getId())),
'method' => 'PUT',
));
$form->add('submit', SubmitType::class, array('label' => 'Update'));
return $form;
}
/**
* Edits an existing Status entity.
*
*/
public function updateAction(Request $request, $id)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('ChillEventBundle:Status')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Status entity.');
}
$deleteForm = $this->createDeleteForm($id);
$editForm = $this->createEditForm($entity);
$editForm->handleRequest($request);
if ($editForm->isValid()) {
$em->flush();
return $this->redirect($this->generateUrl('chill_event_admin_status', array('id' => $id)));
}
return $this->render('ChillEventBundle:Status:edit.html.twig', array(
'entity' => $entity,
'edit_form' => $editForm->createView(),
'delete_form' => $deleteForm->createView(),
));
}
/**
* Deletes a Status entity.
*
* @param mixed $id
*/
public function deleteAction(Request $request, $id)
{
@@ -207,6 +69,133 @@ class StatusController extends AbstractController
return $this->redirect($this->generateUrl('chill_event_admin_status'));
}
/**
* Displays a form to edit an existing Status entity.
*
* @param mixed $id
*/
public function editAction($id)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('ChillEventBundle:Status')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Status entity.');
}
$editForm = $this->createEditForm($entity);
$deleteForm = $this->createDeleteForm($id);
return $this->render('ChillEventBundle:Status:edit.html.twig', [
'entity' => $entity,
'edit_form' => $editForm->createView(),
'delete_form' => $deleteForm->createView(),
]);
}
/**
* Lists all Status entities.
*/
public function indexAction()
{
$em = $this->getDoctrine()->getManager();
$entities = $em->getRepository('ChillEventBundle:Status')->findAll();
return $this->render('ChillEventBundle:Status:index.html.twig', [
'entities' => $entities,
]);
}
/**
* Displays a form to create a new Status entity.
*/
public function newAction()
{
$entity = new Status();
$form = $this->createCreateForm($entity);
return $this->render('ChillEventBundle:Status:new.html.twig', [
'entity' => $entity,
'form' => $form->createView(),
]);
}
/**
* Finds and displays a Status entity.
*
* @param mixed $id
*/
public function showAction($id)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('ChillEventBundle:Status')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Status entity.');
}
$deleteForm = $this->createDeleteForm($id);
return $this->render('ChillEventBundle:Status:show.html.twig', [
'entity' => $entity,
'delete_form' => $deleteForm->createView(),
]);
}
/**
* Edits an existing Status entity.
*
* @param mixed $id
*/
public function updateAction(Request $request, $id)
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('ChillEventBundle:Status')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Status entity.');
}
$deleteForm = $this->createDeleteForm($id);
$editForm = $this->createEditForm($entity);
$editForm->handleRequest($request);
if ($editForm->isValid()) {
$em->flush();
return $this->redirect($this->generateUrl('chill_event_admin_status', ['id' => $id]));
}
return $this->render('ChillEventBundle:Status:edit.html.twig', [
'entity' => $entity,
'edit_form' => $editForm->createView(),
'delete_form' => $deleteForm->createView(),
]);
}
/**
* Creates a form to create a Status entity.
*
* @param Status $entity The entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createCreateForm(Status $entity)
{
$form = $this->createForm(StatusType::class, $entity, [
'action' => $this->generateUrl('chill_event_admin_status_create'),
'method' => 'POST',
]);
$form->add('submit', SubmitType::class, ['label' => 'Create']);
return $form;
}
/**
* Creates a form to delete a Status entity by id.
*
@@ -217,10 +206,28 @@ class StatusController extends AbstractController
private function createDeleteForm($id)
{
return $this->createFormBuilder()
->setAction($this->generateUrl('chill_event_admin_status_delete', array('id' => $id)))
->setAction($this->generateUrl('chill_event_admin_status_delete', ['id' => $id]))
->setMethod('DELETE')
->add('submit', SubmitType::class, array('label' => 'Delete'))
->getForm()
;
->add('submit', SubmitType::class, ['label' => 'Delete'])
->getForm();
}
/**
* Creates a form to edit a Status entity.
*
* @param Status $entity The entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createEditForm(Status $entity)
{
$form = $this->createForm(StatusType::class, $entity, [
'action' => $this->generateUrl('chill_event_admin_status_update', ['id' => $entity->getId()]),
'method' => 'PUT',
]);
$form->add('submit', SubmitType::class, ['label' => 'Update']);
return $form;
}
}