Exemplo n.º 1
0
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     parent::buildForm($builder, $options);
     $builder->add('methods', 'choice', ['choices' => ArraysHelper::arrayFillEqualPairs(Request::getMethods()), 'multiple' => true, 'expanded' => true, 'label' => false, 'required' => true]);
 }
Exemplo n.º 2
0
 public static function loadValidatorMetadata(ClassMetadata $metadata)
 {
     $metadata->addPropertyConstraint('methods', new NotBlank(['message' => "At least one method must be selected."]));
     $metadata->addPropertyConstraint('methods', new Choice(['message' => "At least one method must be selected.", 'choices' => Request::getMethods(), 'multiple' => true]));
 }
Exemplo n.º 3
0
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('method', 'choice', ['choices' => ArraysHelper::arrayFillEqualPairs(Request::getMethods()), 'label' => 'Method', 'required' => false, 'empty_data' => '', 'multiple' => false, 'constraints' => [new Choice(['message' => "Method must be selected.", 'choices' => array_merge([''], Request::getMethods()), 'multiple' => false])], 'attr' => ['class' => 'form-control']]);
     $isAjaxChoices = ['no', 'yes'];
     $builder->add('is_ajax', 'choice', ['label' => 'Is Ajax', 'required' => true, 'empty_data' => '', 'choices' => ArraysHelper::arrayFillEqualPairs($isAjaxChoices), 'constraints' => [new Choice(['message' => "Incorrect value selected", 'choices' => $isAjaxChoices, 'multiple' => false])], 'attr' => ['class' => 'form-control']]);
 }