fix deprecation: no more passing of type instances

This commit is contained in:
nobohan 2018-04-05 11:45:58 +02:00
parent ed00833eb8
commit 478e1c505d
7 changed files with 36 additions and 31 deletions

View File

@ -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(),

View File

@ -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',
));

View File

@ -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',
));

View File

@ -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',
));

View File

@ -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')

View File

@ -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,
* <http://www.champs-libres.coop>, <info@champs-libres.coop>
*
*
* 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 <http://www.gnu.org/licenses/>.
*/
@ -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;

View File

@ -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,
* <http://www.champs-libres.coop>, <info@champs-libres.coop>
*
*
* 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 <http://www.gnu.org/licenses/>.
*/
@ -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();