Commit be6d3493 authored by Julien Minet's avatar Julien Minet

fix deprecations: setDefaultOptions -> configureOptions

parent 71a375b3
Pipeline #45900 failed with stages
in 1 minute and 7 seconds
......@@ -4,7 +4,7 @@ namespace Chill\PersonBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormView;
......@@ -59,9 +59,9 @@ class AccompanyingPeriodType extends AbstractType
}
/**
* @param OptionsResolverInterface $resolver
* @param OptionsResolver $resolver
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'Chill\PersonBundle\Entity\AccompanyingPeriod'
......
......@@ -88,7 +88,7 @@ class CreationPersonType extends AbstractType
->add('lastName')
->add('birthdate', DateType::class, array('required' => false,
'widget' => 'single_text', 'format' => 'dd-MM-yyyy'))
->add('gender', new GenderType(), array(
->add('gender', GenderType::class, array(
'required' => true, 'empty_value' => null
))
->add('creation_date', DateType::class, array(
......
......@@ -64,7 +64,7 @@ class PersonType extends AbstractType
->add('firstName')
->add('lastName')
->add('birthdate', DateType::class, array('required' => false, 'widget' => 'single_text', 'format' => 'dd-MM-yyyy'))
->add('gender', new GenderType(), array(
->add('gender', GenderType::class, array(
'required' => true
))
->add('memo', TextareaType::class, array('required' => false))
......
......@@ -5,6 +5,7 @@ namespace Chill\PersonBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* A type to add a closing motive
......@@ -13,34 +14,34 @@ use Symfony\Component\HttpFoundation\Request;
*/
class ClosingMotiveType extends AbstractType
{
private $locale;
public function __construct(Request $request = NULL)
{
if ($request !== NULL) {
$this->locale = $request->getLocale();
}
}
public function getName()
{
return 'closing_motive';
}
public function getParent()
{
return 'entity';
}
public function setDefaultOptions(\Symfony\Component\OptionsResolver\OptionsResolverInterface $resolver)
public function configureOptions(OptionsResolver $resolver)
{
if ($this->locale === NULL) {
throw new \LogicException('the locale should be defined and is extracted '
. 'from the \'request\' service. Maybe was this service '
. 'unaccessible ?');
}
$resolver->setDefaults(array(
'class' => 'ChillPersonBundle:AccompanyingPeriod\ClosingMotive',
'empty_data' => null,
......@@ -49,5 +50,5 @@ class ClosingMotiveType extends AbstractType
)
);
}
}
......@@ -3,7 +3,7 @@
namespace Chill\PersonBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Chill\PersonBundle\Entity\Person;
......@@ -15,16 +15,11 @@ use Chill\PersonBundle\Entity\Person;
*/
class GenderType extends AbstractType {
public function getName() {
return 'gender';
}
public function getParent() {
return ChoiceType::class;
}
public function setDefaultOptions(OptionsResolverInterface $resolver) {
public function configureOptions(OptionsResolver $resolver) {
$a = array(
Person::MALE_GENDER => Person::MALE_GENDER,
......
......@@ -21,7 +21,7 @@
namespace Chill\PersonBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Chill\MainBundle\Form\Type\DataTransformer\ObjectToIdTransformer;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\HttpFoundation\RequestStack;
......@@ -61,7 +61,7 @@ class Select2MaritalStatusType extends AbstractType
$builder->addModelTransformer($transformer);
}
public function setDefaultOptions(OptionsResolverInterface $resolver)
public function configureOptions(OptionsResolver $resolver)
{
$locale = $this->requestStack->getCurrentRequest()->getLocale();
$maritalStatuses = $this->em->getRepository('Chill\PersonBundle\Entity\MaritalStatus')->findAll();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment