<?php
namespace Aqarmap\Bundle\DiscussionBundle\Form;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class DiscussionSearchType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('location', ChoiceType::class, [
'required' => true,
'placeholder' => 'layout.locations',
'choices' => $options['selectedLocation'],
'data' => $options['selectedLocationId'],
])
->add('category', EntityType::class, [
'required' => true,
'class' => 'AqarmapDiscussionBundle:Category',
'placeholder' => 'neighborhoods.discussion.placeholder.all_categories',
])
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => 'Aqarmap\Bundle\DiscussionBundle\Entity\Discussion',
'flatLocations' => [],
'selectedLocation' => [],
'selectedLocationId' => null,
]);
}
}