Created
November 20, 2017 09:30
-
-
Save ollo-ride-nico/2022c4690d19fc161c47c542e1d3f649 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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