mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
fix deprecation: no more passing of type instances
This commit is contained in:
parent
ed00833eb8
commit
478e1c505d
@ -25,9 +25,11 @@ 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 Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||||
use Chill\ActivityBundle\Entity\Activity;
|
|
||||||
use Symfony\Component\Security\Core\Role\Role;
|
use Symfony\Component\Security\Core\Role\Role;
|
||||||
|
|
||||||
|
use Chill\ActivityBundle\Entity\Activity;
|
||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
|
use Chill\ActivityBundle\Form\ActivityType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Activity controller.
|
* Activity controller.
|
||||||
@ -130,7 +132,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(ActivityType::class, $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(),
|
||||||
@ -250,7 +252,7 @@ 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(ActivityType::class, $entity, array(
|
||||||
'action' => $this->generateUrl('chill_activity_activity_update',
|
'action' => $this->generateUrl('chill_activity_activity_update',
|
||||||
array(
|
array(
|
||||||
'id' => $entity->getId(),
|
'id' => $entity->getId(),
|
||||||
|
@ -63,7 +63,7 @@ class ActivityReasonCategoryController extends Controller
|
|||||||
*/
|
*/
|
||||||
private function createCreateForm(ActivityReasonCategory $entity)
|
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'),
|
'action' => $this->generateUrl('chill_activity_activityreasoncategory_create'),
|
||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
));
|
));
|
||||||
@ -138,7 +138,7 @@ class ActivityReasonCategoryController extends Controller
|
|||||||
*/
|
*/
|
||||||
private function createEditForm(ActivityReasonCategory $entity)
|
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())),
|
'action' => $this->generateUrl('chill_activity_activityreasoncategory_update', array('id' => $entity->getId())),
|
||||||
'method' => 'PUT',
|
'method' => 'PUT',
|
||||||
));
|
));
|
||||||
|
@ -63,7 +63,7 @@ class ActivityReasonController extends Controller
|
|||||||
*/
|
*/
|
||||||
private function createCreateForm(ActivityReason $entity)
|
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'),
|
'action' => $this->generateUrl('chill_activity_activityreason_create'),
|
||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
));
|
));
|
||||||
@ -138,7 +138,7 @@ class ActivityReasonController extends Controller
|
|||||||
*/
|
*/
|
||||||
private function createEditForm(ActivityReason $entity)
|
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())),
|
'action' => $this->generateUrl('chill_activity_activityreason_update', array('id' => $entity->getId())),
|
||||||
'method' => 'PUT',
|
'method' => 'PUT',
|
||||||
));
|
));
|
||||||
|
@ -63,7 +63,7 @@ class ActivityTypeController extends Controller
|
|||||||
*/
|
*/
|
||||||
private function createCreateForm(ActivityType $entity)
|
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'),
|
'action' => $this->generateUrl('chill_activity_activitytype_create'),
|
||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
));
|
));
|
||||||
@ -138,7 +138,7 @@ class ActivityTypeController extends Controller
|
|||||||
*/
|
*/
|
||||||
private function createEditForm(ActivityType $entity)
|
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())),
|
'action' => $this->generateUrl('chill_activity_activitytype_update', array('id' => $entity->getId())),
|
||||||
'method' => 'PUT',
|
'method' => 'PUT',
|
||||||
));
|
));
|
||||||
|
@ -17,6 +17,7 @@ use Symfony\Component\Form\FormEvents;
|
|||||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\DateTimeType;
|
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\TranslatableActivityType;
|
||||||
use Chill\ActivityBundle\Form\Type\TranslatableActivityReason;
|
use Chill\ActivityBundle\Form\Type\TranslatableActivityReason;
|
||||||
|
|
||||||
@ -90,7 +91,7 @@ class ActivityType extends AbstractType
|
|||||||
);
|
);
|
||||||
|
|
||||||
$builder
|
$builder
|
||||||
->add('date', 'date', array(
|
->add('date', DateType::class, array(
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'widget' => 'single_text',
|
'widget' => 'single_text',
|
||||||
'format' => 'dd-MM-yyyy')
|
'format' => 'dd-MM-yyyy')
|
||||||
|
@ -2,20 +2,20 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* 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
|
||||||
* it under the terms of the GNU Affero General Public License as
|
* it under the terms of the GNU Affero General Public License as
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
* License, or (at your option) any later version.
|
* License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* 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/>.
|
* 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\Form\AbstractType;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
|
|
||||||
@ -34,24 +35,24 @@ use Doctrine\ORM\EntityRepository;
|
|||||||
*/
|
*/
|
||||||
class TranslatableActivityReason extends AbstractType
|
class TranslatableActivityReason extends AbstractType
|
||||||
{
|
{
|
||||||
|
|
||||||
private $translatableStringHelper;
|
private $translatableStringHelper;
|
||||||
|
|
||||||
public function __construct(TranslatableStringHelper $translatableStringHelper)
|
public function __construct(TranslatableStringHelper $translatableStringHelper)
|
||||||
{
|
{
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
$this->translatableStringHelper = $translatableStringHelper;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName()
|
public function getName()
|
||||||
{
|
{
|
||||||
return 'translatable_activity_reason';
|
return 'translatable_activity_reason';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getParent()
|
public function getParent()
|
||||||
{
|
{
|
||||||
return 'entity';
|
return EntityType::class;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function configureOptions(OptionsResolver $resolver)
|
public function configureOptions(OptionsResolver $resolver)
|
||||||
{
|
{
|
||||||
$helper = $this->translatableStringHelper;
|
$helper = $this->translatableStringHelper;
|
||||||
|
@ -2,20 +2,20 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* 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
|
||||||
* it under the terms of the GNU Affero General Public License as
|
* it under the terms of the GNU Affero General Public License as
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
* License, or (at your option) any later version.
|
* License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* 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/>.
|
* 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\Form\AbstractType;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
use Symfony\Component\HttpFoundation\RequestStack;
|
use Symfony\Component\HttpFoundation\RequestStack;
|
||||||
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -40,22 +41,22 @@ class TranslatableActivityReasonCategory extends AbstractType
|
|||||||
* @var RequestStack
|
* @var RequestStack
|
||||||
*/
|
*/
|
||||||
private $requestStack;
|
private $requestStack;
|
||||||
|
|
||||||
public function __construct(RequestStack $requestStack)
|
public function __construct(RequestStack $requestStack)
|
||||||
{
|
{
|
||||||
$this->requestStack = $requestStack;
|
$this->requestStack = $requestStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName()
|
public function getName()
|
||||||
{
|
{
|
||||||
return 'translatable_activity_reason_category';
|
return 'translatable_activity_reason_category';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getParent()
|
public function getParent()
|
||||||
{
|
{
|
||||||
return 'entity';
|
return EntityType::class;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function configureOptions(OptionsResolver $resolver)
|
public function configureOptions(OptionsResolver $resolver)
|
||||||
{
|
{
|
||||||
$locale = $this->requestStack->getCurrentRequest()->getLocale();
|
$locale = $this->requestStack->getCurrentRequest()->getLocale();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user