Skip to content

Instantly share code, notes, and snippets.

@ollo-ride-nico
Created November 20, 2017 09:30
Show Gist options
  • Save ollo-ride-nico/2022c4690d19fc161c47c542e1d3f649 to your computer and use it in GitHub Desktop.
Save ollo-ride-nico/2022c4690d19fc161c47c542e1d3f649 to your computer and use it in GitHub Desktop.
//Pour exemple mon formulaire a jout de trick
class TricksAddType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
// On affiche les champs du builder
$builder
->add('nom', TextType::class)
->add('description', TextareaType::class)
->add('save', SubmitType::class);
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'data_class' => Tricks::class,
));
}
}
//Mon fichier validation.yaml
App\Form\TricksAddType:
properties:
nom:
- NotBlank: ~
description:
- NotBlank: ~
dateInscription:
- NotBlank: ~
- Type: \Datetime
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment