Skip to content

Instantly share code, notes, and snippets.

@GaylordP
Created January 16, 2018 13:07
Show Gist options
  • Save GaylordP/cf82f85a2e9a209751b69e568fbec7d1 to your computer and use it in GitHub Desktop.
Save GaylordP/cf82f85a2e9a209751b69e568fbec7d1 to your computer and use it in GitHub Desktop.
class PersonneVersionType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('emails', CollectionType::class, [
'entry_type' => PersonneVersionEmailType::class,
'label' => false,
'allow_add' => true,
'allow_delete' => true,
'by_reference' => false,
])
;
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => PersonneVersion::class,
'label' => false,
]);
}
}
class PersonneVersionEmailType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('emaila', null, [
'label' => 'label.email',
'ico' => 'envelope',
'translation_domain' => 'user',
])
->add('principal', null, [
'label' => false,
'translation_domain' => 'user',
])
;
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => PersonneVersionEmail::class,
'label' => false,
]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment