diff --git a/Controller/ActivityController.php b/Controller/ActivityController.php index b42475e25..9a24cb503 100644 --- a/Controller/ActivityController.php +++ b/Controller/ActivityController.php @@ -25,9 +25,11 @@ namespace Chill\ActivityBundle\Controller; use Symfony\Component\HttpFoundation\Request; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\Form\Extension\Core\Type\SubmitType; -use Chill\ActivityBundle\Entity\Activity; use Symfony\Component\Security\Core\Role\Role; + +use Chill\ActivityBundle\Entity\Activity; use Chill\PersonBundle\Entity\Person; +use Chill\ActivityBundle\Form\ActivityType; /** * Activity controller. @@ -130,7 +132,7 @@ class ActivityController extends Controller */ private function createCreateForm(Activity $entity) { - $form = $this->createForm('chill_activitybundle_activity', $entity, + $form = $this->createForm(ActivityType::class, $entity, array( 'action' => $this->generateUrl('chill_activity_activity_create', [ 'person_id' => $entity->getPerson()->getId(), @@ -250,7 +252,7 @@ class ActivityController extends Controller */ private function createEditForm(Activity $entity) { - $form = $this->createForm('chill_activitybundle_activity', $entity, array( + $form = $this->createForm(ActivityType::class, $entity, array( 'action' => $this->generateUrl('chill_activity_activity_update', array( 'id' => $entity->getId(), diff --git a/Controller/ActivityReasonCategoryController.php b/Controller/ActivityReasonCategoryController.php index f9f0abe4c..90b72384b 100644 --- a/Controller/ActivityReasonCategoryController.php +++ b/Controller/ActivityReasonCategoryController.php @@ -63,7 +63,7 @@ class ActivityReasonCategoryController extends Controller */ private function createCreateForm(ActivityReasonCategory $entity) { - $form = $this->createForm(new ActivityReasonCategoryType(), $entity, array( + $form = $this->createForm(ActivityReasonCategoryType::class, $entity, array( 'action' => $this->generateUrl('chill_activity_activityreasoncategory_create'), 'method' => 'POST', )); @@ -138,7 +138,7 @@ class ActivityReasonCategoryController extends Controller */ private function createEditForm(ActivityReasonCategory $entity) { - $form = $this->createForm(new ActivityReasonCategoryType(), $entity, array( + $form = $this->createForm(ActivityReasonCategoryType::class, $entity, array( 'action' => $this->generateUrl('chill_activity_activityreasoncategory_update', array('id' => $entity->getId())), 'method' => 'PUT', )); diff --git a/Controller/ActivityReasonController.php b/Controller/ActivityReasonController.php index b6374ec54..c09756942 100644 --- a/Controller/ActivityReasonController.php +++ b/Controller/ActivityReasonController.php @@ -63,7 +63,7 @@ class ActivityReasonController extends Controller */ private function createCreateForm(ActivityReason $entity) { - $form = $this->createForm(new ActivityReasonType(), $entity, array( + $form = $this->createForm(ActivityReasonType::class, $entity, array( 'action' => $this->generateUrl('chill_activity_activityreason_create'), 'method' => 'POST', )); @@ -138,7 +138,7 @@ class ActivityReasonController extends Controller */ private function createEditForm(ActivityReason $entity) { - $form = $this->createForm(new ActivityReasonType(), $entity, array( + $form = $this->createForm(ActivityReasonType::class, $entity, array( 'action' => $this->generateUrl('chill_activity_activityreason_update', array('id' => $entity->getId())), 'method' => 'PUT', )); diff --git a/Controller/ActivityTypeController.php b/Controller/ActivityTypeController.php index 39e4cb647..db004470a 100644 --- a/Controller/ActivityTypeController.php +++ b/Controller/ActivityTypeController.php @@ -63,7 +63,7 @@ class ActivityTypeController extends Controller */ private function createCreateForm(ActivityType $entity) { - $form = $this->createForm(new ActivityTypeType(), $entity, array( + $form = $this->createForm(ActivityTypeType::class, $entity, array( 'action' => $this->generateUrl('chill_activity_activitytype_create'), 'method' => 'POST', )); @@ -138,7 +138,7 @@ class ActivityTypeController extends Controller */ private function createEditForm(ActivityType $entity) { - $form = $this->createForm(new ActivityTypeType(), $entity, array( + $form = $this->createForm(ActivityTypeType::class, $entity, array( 'action' => $this->generateUrl('chill_activity_activitytype_update', array('id' => $entity->getId())), 'method' => 'PUT', )); diff --git a/Form/ActivityType.php b/Form/ActivityType.php index b6dcd248f..68ecf2794 100644 --- a/Form/ActivityType.php +++ b/Form/ActivityType.php @@ -17,6 +17,7 @@ use Symfony\Component\Form\FormEvents; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\TextareaType; use Symfony\Component\Form\Extension\Core\Type\DateTimeType; +use Symfony\Component\Form\Extension\Core\Type\DateType; use Chill\ActivityBundle\Form\Type\TranslatableActivityType; use Chill\ActivityBundle\Form\Type\TranslatableActivityReason; @@ -90,7 +91,7 @@ class ActivityType extends AbstractType ); $builder - ->add('date', 'date', array( + ->add('date', DateType::class, array( 'required' => true, 'widget' => 'single_text', 'format' => 'dd-MM-yyyy') diff --git a/Form/Type/TranslatableActivityReason.php b/Form/Type/TranslatableActivityReason.php index f93e42d62..2a41d4210 100644 --- a/Form/Type/TranslatableActivityReason.php +++ b/Form/Type/TranslatableActivityReason.php @@ -2,20 +2,20 @@ /* * Chill is a software for social workers - * - * Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS, + * + * Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS, * , - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. - * + * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ @@ -24,6 +24,7 @@ namespace Chill\ActivityBundle\Form\Type; use Symfony\Component\Form\AbstractType; use Symfony\Component\OptionsResolver\OptionsResolver; +use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Chill\MainBundle\Templating\TranslatableStringHelper; use Doctrine\ORM\EntityRepository; @@ -34,24 +35,24 @@ use Doctrine\ORM\EntityRepository; */ class TranslatableActivityReason extends AbstractType { - + private $translatableStringHelper; - + public function __construct(TranslatableStringHelper $translatableStringHelper) { $this->translatableStringHelper = $translatableStringHelper; } - + public function getName() { return 'translatable_activity_reason'; } - + public function getParent() { - return 'entity'; + return EntityType::class; } - + public function configureOptions(OptionsResolver $resolver) { $helper = $this->translatableStringHelper; diff --git a/Form/Type/TranslatableActivityReasonCategory.php b/Form/Type/TranslatableActivityReasonCategory.php index ec90c2f9f..cd9686b1c 100644 --- a/Form/Type/TranslatableActivityReasonCategory.php +++ b/Form/Type/TranslatableActivityReasonCategory.php @@ -2,20 +2,20 @@ /* * Chill is a software for social workers - * - * Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS, + * + * Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS, * , - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. - * + * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ @@ -25,6 +25,7 @@ namespace Chill\ActivityBundle\Form\Type; use Symfony\Component\Form\AbstractType; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\HttpFoundation\RequestStack; +use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Doctrine\ORM\EntityRepository; /** @@ -40,22 +41,22 @@ class TranslatableActivityReasonCategory extends AbstractType * @var RequestStack */ private $requestStack; - + public function __construct(RequestStack $requestStack) { $this->requestStack = $requestStack; } - + public function getName() { return 'translatable_activity_reason_category'; } - + public function getParent() { - return 'entity'; + return EntityType::class; } - + public function configureOptions(OptionsResolver $resolver) { $locale = $this->requestStack->getCurrentRequest()->getLocale();