Create gender admin entity and add configuration to use it

entity, migration, controller, repository, templates, form added
This commit is contained in:
2024-09-25 16:02:40 +02:00
parent f7f8319749
commit f428afc7ca
10 changed files with 295 additions and 2 deletions

View File

@@ -0,0 +1,44 @@
<?php
namespace Chill\MainBundle\Form;
use Chill\MainBundle\Entity\Gender;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class GenderType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('label', TranslatableStringFormType::class, [
'required' => true,
])
->add('icon', TextType::class)
->add('isGrammatical', ChoiceType::class, [
'choices' => [
'Grammatical' => true,
'Not grammatical' => false,
],
])
->add('active', ChoiceType::class, [
'choices' => [
'Active' => true,
'Inactive' => false,
],
])
->add('order', IntegerType::class);
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Gender::class,
]);
}
}