mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 21:34:25 +00:00
fix deprecations: use fqcn in the activity bundle
This commit is contained in:
parent
b6f9d1156e
commit
6327d25783
@ -3,7 +3,7 @@
|
|||||||
/*
|
/*
|
||||||
* Chill is a software for social workers
|
* Chill is a software for social workers
|
||||||
*
|
*
|
||||||
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
|
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
|
||||||
* <http://www.champs-libres.coop>, <info@champs-libres.coop>
|
* <http://www.champs-libres.coop>, <info@champs-libres.coop>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
@ -24,6 +24,7 @@ namespace Chill\ActivityBundle\Controller;
|
|||||||
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||||
use Chill\ActivityBundle\Entity\Activity;
|
use Chill\ActivityBundle\Entity\Activity;
|
||||||
use Symfony\Component\Security\Core\Role\Role;
|
use Symfony\Component\Security\Core\Role\Role;
|
||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
@ -43,23 +44,23 @@ class ActivityController extends Controller
|
|||||||
{
|
{
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
$person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
|
$person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
|
||||||
|
|
||||||
if ($person === NULL) {
|
if ($person === NULL) {
|
||||||
throw $this->createNotFoundException('Person not found');
|
throw $this->createNotFoundException('Person not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
|
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
|
||||||
|
|
||||||
$reachableScopes = $this->get('chill.main.security.authorization.helper')
|
$reachableScopes = $this->get('chill.main.security.authorization.helper')
|
||||||
->getReachableScopes($this->getUser(), new Role('CHILL_ACTIVITY_SEE'),
|
->getReachableScopes($this->getUser(), new Role('CHILL_ACTIVITY_SEE'),
|
||||||
$person->getCenter());
|
$person->getCenter());
|
||||||
|
|
||||||
$activities = $em->getRepository('ChillActivityBundle:Activity')
|
$activities = $em->getRepository('ChillActivityBundle:Activity')
|
||||||
->findBy(
|
->findBy(
|
||||||
array('person' => $person, 'scope' => $reachableScopes),
|
array('person' => $person, 'scope' => $reachableScopes),
|
||||||
array('date' => 'DESC')
|
array('date' => 'DESC')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
return $this->render('ChillActivityBundle:Activity:list.html.twig', array(
|
return $this->render('ChillActivityBundle:Activity:list.html.twig', array(
|
||||||
'activities' => $activities,
|
'activities' => $activities,
|
||||||
@ -74,13 +75,13 @@ class ActivityController extends Controller
|
|||||||
{
|
{
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
$person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
|
$person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
|
||||||
|
|
||||||
if ($person === NULL) {
|
if ($person === NULL) {
|
||||||
throw $this->createNotFoundException('person not found');
|
throw $this->createNotFoundException('person not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
|
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
|
||||||
|
|
||||||
$entity = new Activity();
|
$entity = new Activity();
|
||||||
$entity->setPerson($person);
|
$entity->setPerson($person);
|
||||||
$form = $this->createCreateForm($entity, $person);
|
$form = $this->createCreateForm($entity, $person);
|
||||||
@ -88,16 +89,16 @@ class ActivityController extends Controller
|
|||||||
|
|
||||||
if ($form->isValid()) {
|
if ($form->isValid()) {
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
$this->denyAccessUnlessGranted('CHILL_ACTIVITY_CREATE', $entity,
|
$this->denyAccessUnlessGranted('CHILL_ACTIVITY_CREATE', $entity,
|
||||||
'creation of this activity not allowed');
|
'creation of this activity not allowed');
|
||||||
|
|
||||||
$em->persist($entity);
|
$em->persist($entity);
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
$this->get('session')
|
$this->get('session')
|
||||||
->getFlashBag()
|
->getFlashBag()
|
||||||
->add('success',
|
->add('success',
|
||||||
$this->get('translator')
|
$this->get('translator')
|
||||||
->trans('Success : activity created!')
|
->trans('Success : activity created!')
|
||||||
);
|
);
|
||||||
@ -106,7 +107,7 @@ class ActivityController extends Controller
|
|||||||
$this->generateUrl('chill_activity_activity_show',
|
$this->generateUrl('chill_activity_activity_show',
|
||||||
array('id' => $entity->getId(), 'person_id' => $person_id)));
|
array('id' => $entity->getId(), 'person_id' => $person_id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->get('session')
|
$this->get('session')
|
||||||
->getFlashBag()->add('danger',
|
->getFlashBag()->add('danger',
|
||||||
$this->get('translator')
|
$this->get('translator')
|
||||||
@ -129,7 +130,7 @@ class ActivityController extends Controller
|
|||||||
*/
|
*/
|
||||||
private function createCreateForm(Activity $entity)
|
private function createCreateForm(Activity $entity)
|
||||||
{
|
{
|
||||||
$form = $this->createForm('chill_activitybundle_activity', $entity,
|
$form = $this->createForm('chill_activitybundle_activity', $entity,
|
||||||
array(
|
array(
|
||||||
'action' => $this->generateUrl('chill_activity_activity_create', [
|
'action' => $this->generateUrl('chill_activity_activity_create', [
|
||||||
'person_id' => $entity->getPerson()->getId(),
|
'person_id' => $entity->getPerson()->getId(),
|
||||||
@ -151,20 +152,20 @@ class ActivityController extends Controller
|
|||||||
{
|
{
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
$person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
|
$person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
|
||||||
|
|
||||||
if ($person === NULL){
|
if ($person === NULL){
|
||||||
throw $this->createNotFoundException('Person not found');
|
throw $this->createNotFoundException('Person not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
|
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
|
||||||
|
|
||||||
$entity = new Activity();
|
$entity = new Activity();
|
||||||
$entity->setUser($this->get('security.token_storage')->getToken()->getUser());
|
$entity->setUser($this->get('security.token_storage')->getToken()->getUser());
|
||||||
$entity->setPerson($person);
|
$entity->setPerson($person);
|
||||||
$entity->setDate(new \DateTime('now'));
|
$entity->setDate(new \DateTime('now'));
|
||||||
|
|
||||||
$this->denyAccessUnlessGranted('CHILL_ACTIVITY_CREATE', $entity);
|
$this->denyAccessUnlessGranted('CHILL_ACTIVITY_CREATE', $entity);
|
||||||
|
|
||||||
$form = $this->createCreateForm($entity, $person);
|
$form = $this->createCreateForm($entity, $person);
|
||||||
|
|
||||||
return $this->render('ChillActivityBundle:Activity:new.html.twig', array(
|
return $this->render('ChillActivityBundle:Activity:new.html.twig', array(
|
||||||
@ -182,11 +183,11 @@ class ActivityController extends Controller
|
|||||||
{
|
{
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
$person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
|
$person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
|
||||||
|
|
||||||
if (!$person) {
|
if (!$person) {
|
||||||
throw $this->createNotFoundException('person not found');
|
throw $this->createNotFoundException('person not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
|
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
|
||||||
|
|
||||||
$entity = $em->getRepository('ChillActivityBundle:Activity')->find($id);
|
$entity = $em->getRepository('ChillActivityBundle:Activity')->find($id);
|
||||||
@ -194,7 +195,7 @@ class ActivityController extends Controller
|
|||||||
if (!$entity) {
|
if (!$entity) {
|
||||||
throw $this->createNotFoundException('Unable to find Activity entity.');
|
throw $this->createNotFoundException('Unable to find Activity entity.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->denyAccessUnlessGranted('CHILL_ACTIVITY_SEE', $entity);
|
$this->denyAccessUnlessGranted('CHILL_ACTIVITY_SEE', $entity);
|
||||||
|
|
||||||
$deleteForm = $this->createDeleteForm($id, $person);
|
$deleteForm = $this->createDeleteForm($id, $person);
|
||||||
@ -214,11 +215,11 @@ class ActivityController extends Controller
|
|||||||
{
|
{
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
$person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
|
$person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
|
||||||
|
|
||||||
if (!$person) {
|
if (!$person) {
|
||||||
throw $this->createNotFoundException('person not found');
|
throw $this->createNotFoundException('person not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
|
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
|
||||||
|
|
||||||
$entity = $em->getRepository('ChillActivityBundle:Activity')->find($id);
|
$entity = $em->getRepository('ChillActivityBundle:Activity')->find($id);
|
||||||
@ -226,7 +227,7 @@ class ActivityController extends Controller
|
|||||||
if (!$entity) {
|
if (!$entity) {
|
||||||
throw $this->createNotFoundException('Unable to find Activity entity.');
|
throw $this->createNotFoundException('Unable to find Activity entity.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->denyAccessUnlessGranted('CHILL_ACTIVITY_UPDATE', $entity);
|
$this->denyAccessUnlessGranted('CHILL_ACTIVITY_UPDATE', $entity);
|
||||||
|
|
||||||
$editForm = $this->createEditForm($entity);
|
$editForm = $this->createEditForm($entity);
|
||||||
@ -250,9 +251,9 @@ class ActivityController extends Controller
|
|||||||
private function createEditForm(Activity $entity)
|
private function createEditForm(Activity $entity)
|
||||||
{
|
{
|
||||||
$form = $this->createForm('chill_activitybundle_activity', $entity, array(
|
$form = $this->createForm('chill_activitybundle_activity', $entity, array(
|
||||||
'action' => $this->generateUrl('chill_activity_activity_update',
|
'action' => $this->generateUrl('chill_activity_activity_update',
|
||||||
array(
|
array(
|
||||||
'id' => $entity->getId(),
|
'id' => $entity->getId(),
|
||||||
'person_id' => $entity->getPerson()->getId()
|
'person_id' => $entity->getPerson()->getId()
|
||||||
)),
|
)),
|
||||||
'method' => 'PUT',
|
'method' => 'PUT',
|
||||||
@ -269,14 +270,14 @@ class ActivityController extends Controller
|
|||||||
public function updateAction(Request $request, $person_id, $id)
|
public function updateAction(Request $request, $person_id, $id)
|
||||||
{
|
{
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
$person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
|
$person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
|
||||||
$entity = $em->getRepository('ChillActivityBundle:Activity')->find($id);
|
$entity = $em->getRepository('ChillActivityBundle:Activity')->find($id);
|
||||||
|
|
||||||
if (!$entity) {
|
if (!$entity) {
|
||||||
throw $this->createNotFoundException('Unable to find Activity entity.');
|
throw $this->createNotFoundException('Unable to find Activity entity.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->denyAccessUnlessGranted('CHILL_ACTIVITY_UPDATE', $entity);
|
$this->denyAccessUnlessGranted('CHILL_ACTIVITY_UPDATE', $entity);
|
||||||
|
|
||||||
$deleteForm = $this->createDeleteForm($id, $person);
|
$deleteForm = $this->createDeleteForm($id, $person);
|
||||||
@ -285,17 +286,17 @@ class ActivityController extends Controller
|
|||||||
|
|
||||||
if ($editForm->isValid()) {
|
if ($editForm->isValid()) {
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
$this->get('session')
|
$this->get('session')
|
||||||
->getFlashBag()
|
->getFlashBag()
|
||||||
->add('success',
|
->add('success',
|
||||||
$this->get('translator')
|
$this->get('translator')
|
||||||
->trans('Success : activity updated!')
|
->trans('Success : activity updated!')
|
||||||
);
|
);
|
||||||
//die();
|
//die();
|
||||||
return $this->redirect($this->generateUrl('chill_activity_activity_show', array('id' => $id, 'person_id' => $person_id)));
|
return $this->redirect($this->generateUrl('chill_activity_activity_show', array('id' => $id, 'person_id' => $person_id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->get('session')
|
$this->get('session')
|
||||||
->getFlashBag()
|
->getFlashBag()
|
||||||
->add('danger',
|
->add('danger',
|
||||||
@ -309,7 +310,7 @@ class ActivityController extends Controller
|
|||||||
'delete_form' => $deleteForm->createView(),
|
'delete_form' => $deleteForm->createView(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes a Activity entity.
|
* Deletes a Activity entity.
|
||||||
*
|
*
|
||||||
@ -317,7 +318,7 @@ class ActivityController extends Controller
|
|||||||
public function deleteAction(Request $request, $id, $person_id)
|
public function deleteAction(Request $request, $id, $person_id)
|
||||||
{
|
{
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
/* @var $activity Activity */
|
/* @var $activity Activity */
|
||||||
$activity = $em->getRepository('ChillActivityBundle:Activity')
|
$activity = $em->getRepository('ChillActivityBundle:Activity')
|
||||||
->find($id);
|
->find($id);
|
||||||
@ -326,17 +327,17 @@ class ActivityController extends Controller
|
|||||||
if (!$activity) {
|
if (!$activity) {
|
||||||
throw $this->createNotFoundException('Unable to find Activity entity.');
|
throw $this->createNotFoundException('Unable to find Activity entity.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->denyAccessUnlessGranted('CHILL_ACTIVITY_DELETE', $activity);
|
$this->denyAccessUnlessGranted('CHILL_ACTIVITY_DELETE', $activity);
|
||||||
|
|
||||||
$form = $this->createDeleteForm($id, $person);
|
$form = $this->createDeleteForm($id, $person);
|
||||||
|
|
||||||
if ($request->getMethod() === Request::METHOD_DELETE) {
|
if ($request->getMethod() === Request::METHOD_DELETE) {
|
||||||
$form->handleRequest($request);
|
$form->handleRequest($request);
|
||||||
|
|
||||||
if ($form->isValid()) {
|
if ($form->isValid()) {
|
||||||
$logger = $this->get('chill.main.logger');
|
$logger = $this->get('chill.main.logger');
|
||||||
|
|
||||||
$logger->notice("An activity has been removed", array(
|
$logger->notice("An activity has been removed", array(
|
||||||
'by_user' => $this->getUser()->getUsername(),
|
'by_user' => $this->getUser()->getUsername(),
|
||||||
'activity_id' => $activity->getId(),
|
'activity_id' => $activity->getId(),
|
||||||
@ -351,26 +352,26 @@ class ActivityController extends Controller
|
|||||||
'date' => $activity->getDate()->format('Y-m-d'),
|
'date' => $activity->getDate()->format('Y-m-d'),
|
||||||
'attendee' => $activity->getAttendee()
|
'attendee' => $activity->getAttendee()
|
||||||
));
|
));
|
||||||
|
|
||||||
$em->remove($activity);
|
$em->remove($activity);
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
$this->addFlash('success', $this->get('translator')
|
$this->addFlash('success', $this->get('translator')
|
||||||
->trans("The activity has been successfully removed."));
|
->trans("The activity has been successfully removed."));
|
||||||
|
|
||||||
return $this->redirect($this->generateUrl(
|
return $this->redirect($this->generateUrl(
|
||||||
'chill_activity_activity_list', array(
|
'chill_activity_activity_list', array(
|
||||||
'person_id' => $person_id
|
'person_id' => $person_id
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->render('ChillActivityBundle:Activity:confirm_delete.html.twig', array(
|
return $this->render('ChillActivityBundle:Activity:confirm_delete.html.twig', array(
|
||||||
'activity' => $activity,
|
'activity' => $activity,
|
||||||
'delete_form' => $form->createView()
|
'delete_form' => $form->createView()
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -387,7 +388,7 @@ class ActivityController extends Controller
|
|||||||
'chill_activity_activity_delete',
|
'chill_activity_activity_delete',
|
||||||
array('id' => $id, 'person_id' => $person->getId())))
|
array('id' => $id, 'person_id' => $person->getId())))
|
||||||
->setMethod('DELETE')
|
->setMethod('DELETE')
|
||||||
->add('submit', 'submit', array('label' => 'Delete'))
|
->add('submit', SubmitType::class, array('label' => 'Delete'))
|
||||||
->getForm()
|
->getForm()
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ namespace Chill\ActivityBundle\Controller;
|
|||||||
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||||
|
|
||||||
use Chill\ActivityBundle\Entity\ActivityReasonCategory;
|
use Chill\ActivityBundle\Entity\ActivityReasonCategory;
|
||||||
use Chill\ActivityBundle\Form\ActivityReasonCategoryType;
|
use Chill\ActivityBundle\Form\ActivityReasonCategoryType;
|
||||||
@ -67,7 +68,7 @@ class ActivityReasonCategoryController extends Controller
|
|||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
));
|
));
|
||||||
|
|
||||||
$form->add('submit', 'submit', array('label' => 'Create'));
|
$form->add('submit', SubmitType::class, array('label' => 'Create'));
|
||||||
|
|
||||||
return $form;
|
return $form;
|
||||||
}
|
}
|
||||||
@ -142,7 +143,7 @@ class ActivityReasonCategoryController extends Controller
|
|||||||
'method' => 'PUT',
|
'method' => 'PUT',
|
||||||
));
|
));
|
||||||
|
|
||||||
$form->add('submit', 'submit', array('label' => 'Update'));
|
$form->add('submit', SubmitType::class, array('label' => 'Update'));
|
||||||
|
|
||||||
return $form;
|
return $form;
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ namespace Chill\ActivityBundle\Controller;
|
|||||||
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||||
|
|
||||||
use Chill\ActivityBundle\Entity\ActivityReason;
|
use Chill\ActivityBundle\Entity\ActivityReason;
|
||||||
use Chill\ActivityBundle\Form\ActivityReasonType;
|
use Chill\ActivityBundle\Form\ActivityReasonType;
|
||||||
@ -67,7 +68,7 @@ class ActivityReasonController extends Controller
|
|||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
));
|
));
|
||||||
|
|
||||||
$form->add('submit', 'submit', array('label' => 'Create'));
|
$form->add('submit', SubmitType::class, array('label' => 'Create'));
|
||||||
|
|
||||||
return $form;
|
return $form;
|
||||||
}
|
}
|
||||||
@ -142,7 +143,7 @@ class ActivityReasonController extends Controller
|
|||||||
'method' => 'PUT',
|
'method' => 'PUT',
|
||||||
));
|
));
|
||||||
|
|
||||||
$form->add('submit', 'submit', array('label' => 'Update'));
|
$form->add('submit', SubmitType::class, array('label' => 'Update'));
|
||||||
|
|
||||||
return $form;
|
return $form;
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ namespace Chill\ActivityBundle\Controller;
|
|||||||
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||||
|
|
||||||
use Chill\ActivityBundle\Entity\ActivityType;
|
use Chill\ActivityBundle\Entity\ActivityType;
|
||||||
use Chill\ActivityBundle\Form\ActivityTypeType;
|
use Chill\ActivityBundle\Form\ActivityTypeType;
|
||||||
@ -67,7 +68,7 @@ class ActivityTypeController extends Controller
|
|||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
));
|
));
|
||||||
|
|
||||||
$form->add('submit', 'submit', array('label' => 'Create'));
|
$form->add('submit', SubmitType::class, array('label' => 'Create'));
|
||||||
|
|
||||||
return $form;
|
return $form;
|
||||||
}
|
}
|
||||||
@ -142,7 +143,7 @@ class ActivityTypeController extends Controller
|
|||||||
'method' => 'PUT',
|
'method' => 'PUT',
|
||||||
));
|
));
|
||||||
|
|
||||||
$form->add('submit', 'submit', array('label' => 'Update'));
|
$form->add('submit', SubmitType::class, array('label' => 'Update'));
|
||||||
|
|
||||||
return $form;
|
return $form;
|
||||||
}
|
}
|
||||||
@ -159,7 +160,7 @@ class ActivityTypeController extends Controller
|
|||||||
if (!$entity) {
|
if (!$entity) {
|
||||||
throw $this->createNotFoundException('Unable to find ActivityType entity.');
|
throw $this->createNotFoundException('Unable to find ActivityType entity.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$editForm = $this->createEditForm($entity);
|
$editForm = $this->createEditForm($entity);
|
||||||
$editForm->handleRequest($request);
|
$editForm->handleRequest($request);
|
||||||
|
|
||||||
|
@ -5,6 +5,8 @@ namespace Chill\ActivityBundle\Form;
|
|||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||||
|
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
|
||||||
|
|
||||||
class ActivityReasonCategoryType extends AbstractType
|
class ActivityReasonCategoryType extends AbstractType
|
||||||
{
|
{
|
||||||
@ -15,8 +17,8 @@ class ActivityReasonCategoryType extends AbstractType
|
|||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||||
{
|
{
|
||||||
$builder
|
$builder
|
||||||
->add('name', 'translatable_string')
|
->add('name', TranslatableStringFormType::class)
|
||||||
->add('active', 'checkbox', array('required' => false))
|
->add('active', CheckboxType::class, array('required' => false))
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,8 @@ namespace Chill\ActivityBundle\Form;
|
|||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||||
|
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
|
||||||
|
|
||||||
class ActivityReasonType extends AbstractType
|
class ActivityReasonType extends AbstractType
|
||||||
{
|
{
|
||||||
@ -15,8 +17,8 @@ class ActivityReasonType extends AbstractType
|
|||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||||
{
|
{
|
||||||
$builder
|
$builder
|
||||||
->add('name', 'translatable_string')
|
->add('name', TranslatableStringFormType::class)
|
||||||
->add('active', 'checkbox', array('required' => false))
|
->add('active', CheckboxType::class, array('required' => false))
|
||||||
->add('category', 'translatable_activity_reason_category')
|
->add('category', 'translatable_activity_reason_category')
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ use Symfony\Component\Form\AbstractType;
|
|||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||||
|
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
|
||||||
|
|
||||||
class ActivityTypeType extends AbstractType
|
class ActivityTypeType extends AbstractType
|
||||||
{
|
{
|
||||||
@ -16,7 +17,7 @@ class ActivityTypeType extends AbstractType
|
|||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||||
{
|
{
|
||||||
$builder
|
$builder
|
||||||
->add('name', 'translatable_string')
|
->add('name', TranslatableStringFormType::class)
|
||||||
->add('active', ChoiceType::class, array(
|
->add('active', ChoiceType::class, array(
|
||||||
'choices' => array(
|
'choices' => array(
|
||||||
'Yes' => true,
|
'Yes' => true,
|
||||||
@ -26,7 +27,7 @@ class ActivityTypeType extends AbstractType
|
|||||||
'expanded' => true
|
'expanded' => true
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param OptionsResolverInterface $resolver
|
* @param OptionsResolverInterface $resolver
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user