mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-05 22:35:01 +00:00
cs: Fix code style (safe rules only).
This commit is contained in:
@@ -1,38 +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\ActivityBundle\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
|
||||
use Chill\ActivityBundle\Entity\ActivityReason;
|
||||
use Chill\ActivityBundle\Form\ActivityReasonType;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
* ActivityReason controller.
|
||||
*
|
||||
*/
|
||||
class ActivityReasonController extends AbstractController
|
||||
{
|
||||
|
||||
/**
|
||||
* Lists all ActivityReason entities.
|
||||
*
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
$entities = $em->getRepository('ChillActivityBundle:ActivityReason')->findAll();
|
||||
|
||||
return $this->render('ChillActivityBundle:ActivityReason:index.html.twig', array(
|
||||
'entities' => $entities,
|
||||
));
|
||||
}
|
||||
/**
|
||||
* Creates a new ActivityReason entity.
|
||||
*
|
||||
*/
|
||||
public function createAction(Request $request)
|
||||
{
|
||||
@@ -45,71 +35,19 @@ class ActivityReasonController extends AbstractController
|
||||
$em->persist($entity);
|
||||
$em->flush();
|
||||
|
||||
return $this->redirect($this->generateUrl('chill_activity_activityreason', array('id' => $entity->getId())));
|
||||
return $this->redirect($this->generateUrl('chill_activity_activityreason', ['id' => $entity->getId()]));
|
||||
}
|
||||
|
||||
return $this->render('ChillActivityBundle:ActivityReason:new.html.twig', array(
|
||||
return $this->render('ChillActivityBundle:ActivityReason:new.html.twig', [
|
||||
'entity' => $entity,
|
||||
'form' => $form->createView(),
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a form to create a ActivityReason entity.
|
||||
*
|
||||
* @param ActivityReason $entity The entity
|
||||
*
|
||||
* @return \Symfony\Component\Form\Form The form
|
||||
*/
|
||||
private function createCreateForm(ActivityReason $entity)
|
||||
{
|
||||
$form = $this->createForm(ActivityReasonType::class, $entity, array(
|
||||
'action' => $this->generateUrl('chill_activity_activityreason_create'),
|
||||
'method' => 'POST',
|
||||
));
|
||||
|
||||
$form->add('submit', SubmitType::class, array('label' => 'Create'));
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a form to create a new ActivityReason entity.
|
||||
*
|
||||
*/
|
||||
public function newAction()
|
||||
{
|
||||
$entity = new ActivityReason();
|
||||
$form = $this->createCreateForm($entity);
|
||||
|
||||
return $this->render('ChillActivityBundle:ActivityReason:new.html.twig', array(
|
||||
'entity' => $entity,
|
||||
'form' => $form->createView(),
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds and displays a ActivityReason entity.
|
||||
*
|
||||
*/
|
||||
public function showAction($id)
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
$entity = $em->getRepository('ChillActivityBundle:ActivityReason')->find($id);
|
||||
|
||||
if (!$entity) {
|
||||
throw $this->createNotFoundException('Unable to find ActivityReason entity.');
|
||||
}
|
||||
|
||||
return $this->render('ChillActivityBundle:ActivityReason:show.html.twig', array(
|
||||
'entity' => $entity,
|
||||
));
|
||||
'form' => $form->createView(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a form to edit an existing ActivityReason entity.
|
||||
*
|
||||
* @param mixed $id
|
||||
*/
|
||||
public function editAction($id)
|
||||
{
|
||||
@@ -123,33 +61,64 @@ class ActivityReasonController extends AbstractController
|
||||
|
||||
$editForm = $this->createEditForm($entity);
|
||||
|
||||
return $this->render('ChillActivityBundle:ActivityReason:edit.html.twig', array(
|
||||
'entity' => $entity,
|
||||
'edit_form' => $editForm->createView()
|
||||
));
|
||||
return $this->render('ChillActivityBundle:ActivityReason:edit.html.twig', [
|
||||
'entity' => $entity,
|
||||
'edit_form' => $editForm->createView(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a form to edit a ActivityReason entity.
|
||||
*
|
||||
* @param ActivityReason $entity The entity
|
||||
*
|
||||
* @return \Symfony\Component\Form\Form The form
|
||||
*/
|
||||
private function createEditForm(ActivityReason $entity)
|
||||
* Lists all ActivityReason entities.
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
$form = $this->createForm(ActivityReasonType::class, $entity, array(
|
||||
'action' => $this->generateUrl('chill_activity_activityreason_update', array('id' => $entity->getId())),
|
||||
'method' => 'PUT',
|
||||
));
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
$form->add('submit', SubmitType::class, array('label' => 'Update'));
|
||||
$entities = $em->getRepository('ChillActivityBundle:ActivityReason')->findAll();
|
||||
|
||||
return $form;
|
||||
return $this->render('ChillActivityBundle:ActivityReason:index.html.twig', [
|
||||
'entities' => $entities,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a form to create a new ActivityReason entity.
|
||||
*/
|
||||
public function newAction()
|
||||
{
|
||||
$entity = new ActivityReason();
|
||||
$form = $this->createCreateForm($entity);
|
||||
|
||||
return $this->render('ChillActivityBundle:ActivityReason:new.html.twig', [
|
||||
'entity' => $entity,
|
||||
'form' => $form->createView(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds and displays a ActivityReason entity.
|
||||
*
|
||||
* @param mixed $id
|
||||
*/
|
||||
public function showAction($id)
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
$entity = $em->getRepository('ChillActivityBundle:ActivityReason')->find($id);
|
||||
|
||||
if (!$entity) {
|
||||
throw $this->createNotFoundException('Unable to find ActivityReason entity.');
|
||||
}
|
||||
|
||||
return $this->render('ChillActivityBundle:ActivityReason:show.html.twig', [
|
||||
'entity' => $entity,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Edits an existing ActivityReason entity.
|
||||
*
|
||||
* @param mixed $id
|
||||
*/
|
||||
public function updateAction(Request $request, $id)
|
||||
{
|
||||
@@ -167,12 +136,50 @@ class ActivityReasonController extends AbstractController
|
||||
if ($editForm->isValid()) {
|
||||
$em->flush();
|
||||
|
||||
return $this->redirect($this->generateUrl('chill_activity_activityreason', array('id' => $id)));
|
||||
return $this->redirect($this->generateUrl('chill_activity_activityreason', ['id' => $id]));
|
||||
}
|
||||
|
||||
return $this->render('ChillActivityBundle:ActivityReason:edit.html.twig', array(
|
||||
'entity' => $entity,
|
||||
'edit_form' => $editForm->createView()
|
||||
));
|
||||
return $this->render('ChillActivityBundle:ActivityReason:edit.html.twig', [
|
||||
'entity' => $entity,
|
||||
'edit_form' => $editForm->createView(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a form to create a ActivityReason entity.
|
||||
*
|
||||
* @param ActivityReason $entity The entity
|
||||
*
|
||||
* @return \Symfony\Component\Form\Form The form
|
||||
*/
|
||||
private function createCreateForm(ActivityReason $entity)
|
||||
{
|
||||
$form = $this->createForm(ActivityReasonType::class, $entity, [
|
||||
'action' => $this->generateUrl('chill_activity_activityreason_create'),
|
||||
'method' => 'POST',
|
||||
]);
|
||||
|
||||
$form->add('submit', SubmitType::class, ['label' => 'Create']);
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a form to edit a ActivityReason entity.
|
||||
*
|
||||
* @param ActivityReason $entity The entity
|
||||
*
|
||||
* @return \Symfony\Component\Form\Form The form
|
||||
*/
|
||||
private function createEditForm(ActivityReason $entity)
|
||||
{
|
||||
$form = $this->createForm(ActivityReasonType::class, $entity, [
|
||||
'action' => $this->generateUrl('chill_activity_activityreason_update', ['id' => $entity->getId()]),
|
||||
'method' => 'PUT',
|
||||
]);
|
||||
|
||||
$form->add('submit', SubmitType::class, ['label' => 'Update']);
|
||||
|
||||
return $form;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user