From e50e68a52bf2192f4dc7ce98dafd0cc2d27c2ad7 Mon Sep 17 00:00:00 2001 From: nobohan Date: Wed, 4 May 2022 14:09:10 +0200 Subject: [PATCH] admin: add missing data_class option to form types --- .../ChillMainBundle/Controller/CivilityController.php | 1 - .../ChillMainBundle/Controller/CountryController.php | 1 - .../ChillMainBundle/Controller/LanguageController.php | 1 - src/Bundle/ChillMainBundle/Form/CivilityType.php | 11 ++++++++++- src/Bundle/ChillMainBundle/Form/CountryType.php | 11 ++++++++++- src/Bundle/ChillMainBundle/Form/LanguageType.php | 11 ++++++++++- 6 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Controller/CivilityController.php b/src/Bundle/ChillMainBundle/Controller/CivilityController.php index 52b16f634..afda9cc64 100644 --- a/src/Bundle/ChillMainBundle/Controller/CivilityController.php +++ b/src/Bundle/ChillMainBundle/Controller/CivilityController.php @@ -23,5 +23,4 @@ class CivilityController extends CRUDController return parent::orderQuery($action, $query, $request, $paginator); } - } diff --git a/src/Bundle/ChillMainBundle/Controller/CountryController.php b/src/Bundle/ChillMainBundle/Controller/CountryController.php index 351a8d4c3..fe56f3c13 100644 --- a/src/Bundle/ChillMainBundle/Controller/CountryController.php +++ b/src/Bundle/ChillMainBundle/Controller/CountryController.php @@ -23,5 +23,4 @@ class CountryController extends CRUDController return parent::orderQuery($action, $query, $request, $paginator); } - } diff --git a/src/Bundle/ChillMainBundle/Controller/LanguageController.php b/src/Bundle/ChillMainBundle/Controller/LanguageController.php index 33d88ab0e..4612a3728 100644 --- a/src/Bundle/ChillMainBundle/Controller/LanguageController.php +++ b/src/Bundle/ChillMainBundle/Controller/LanguageController.php @@ -23,5 +23,4 @@ class LanguageController extends CRUDController return parent::orderQuery($action, $query, $request, $paginator); } - } diff --git a/src/Bundle/ChillMainBundle/Form/CivilityType.php b/src/Bundle/ChillMainBundle/Form/CivilityType.php index 7dc7959f5..96469b216 100644 --- a/src/Bundle/ChillMainBundle/Form/CivilityType.php +++ b/src/Bundle/ChillMainBundle/Form/CivilityType.php @@ -11,14 +11,16 @@ declare(strict_types=1); namespace Chill\MainBundle\Form; +use Chill\MainBundle\Entity\Civility; use Chill\MainBundle\Form\Type\TranslatableStringFormType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\IntegerType; use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\OptionsResolver\OptionsResolver; class CivilityType extends \Symfony\Component\Form\AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder ->add('name', TranslatableStringFormType::class, [ @@ -33,4 +35,11 @@ class CivilityType extends \Symfony\Component\Form\AbstractType ]) ->add('order', IntegerType::class); } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => Civility::class, + ]); + } } diff --git a/src/Bundle/ChillMainBundle/Form/CountryType.php b/src/Bundle/ChillMainBundle/Form/CountryType.php index 2eb979d85..a1792b0b6 100644 --- a/src/Bundle/ChillMainBundle/Form/CountryType.php +++ b/src/Bundle/ChillMainBundle/Form/CountryType.php @@ -11,13 +11,15 @@ declare(strict_types=1); namespace Chill\MainBundle\Form; +use Chill\MainBundle\Entity\Country; use Chill\MainBundle\Form\Type\TranslatableStringFormType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\OptionsResolver\OptionsResolver; class CountryType extends \Symfony\Component\Form\AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder ->add('name', TranslatableStringFormType::class, [ @@ -29,4 +31,11 @@ class CountryType extends \Symfony\Component\Form\AbstractType 'required' => true, ]); } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => Country::class, + ]); + } } diff --git a/src/Bundle/ChillMainBundle/Form/LanguageType.php b/src/Bundle/ChillMainBundle/Form/LanguageType.php index cb48d15ca..0c4f036de 100644 --- a/src/Bundle/ChillMainBundle/Form/LanguageType.php +++ b/src/Bundle/ChillMainBundle/Form/LanguageType.php @@ -11,13 +11,15 @@ declare(strict_types=1); namespace Chill\MainBundle\Form; +use Chill\MainBundle\Entity\Language; use Chill\MainBundle\Form\Type\TranslatableStringFormType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\OptionsResolver\OptionsResolver; class LanguageType extends \Symfony\Component\Form\AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder ->add('id', TextType::class, [ @@ -29,4 +31,11 @@ class LanguageType extends \Symfony\Component\Form\AbstractType 'required' => true, ]); } + + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => Language::class, + ]); + } }