mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-28 18:43:49 +00:00
fix deprecations: setDefaultOptions -> configureOptions
This commit is contained in:
@@ -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();
|
||||
|
Reference in New Issue
Block a user