Skip to content

Instantly share code, notes, and snippets.

@rileyrg
Created May 31, 2017 13:48
Show Gist options
  • Save rileyrg/64731c8748532c686119f20d77372849 to your computer and use it in GitHub Desktop.
Save rileyrg/64731c8748532c686119f20d77372849 to your computer and use it in GitHub Desktop.
class NameFilterType extends AbstractType
{
//todo NOT USED as wont map to the person object
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('firstName', TextFilterType::class, [
'condition_pattern'=>FilterOperands::OPERAND_SELECTOR,
'required' => false,
'label' => "person.firstName",
'error_bubbling' => false,
]
)
->add('surname', TextFilterType::class, [
'condition_pattern'=>FilterOperands::OPERAND_SELECTOR,
'required' => false,
"label" => "person.surname",
]);
}
public function getBlockPrefix()
{
return 'name_filter';
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'required' => false,
'data_class' => "AppBundle\Entity\Person",
'translation_domain' => null,
]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment