Symfony2 Проверка поля выбора не работает

У меня есть форма в Symfony 2.7.10, определение которой выглядит так:

<?php

// ...

class RecipeType extends AbstractType
{
    // ...

    /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            // ...
            ->add('meal_schema', 'choice', [
            'label'   => 'Mealtime schema',
            'choices' => [
                'breakfast'        => 'Breakfast',
                'second_breakfast' => 'Second breakfast',
                'lunch'            => 'Lunch',
                'dinner'           => 'Dinner',
                'snack'            => 'Snack',
                'supper'           => 'Supper',
            ],
            'multiple' => true,
            'expanded' => true,
            'label_attr' => ['class' => 'col-md-2'],
            'required' => true,
        ])
     }

    // ...
}

Вот как выглядит валидация в файле validation.yml:

My\Real\Namespace\Entity\Recipe:
    properties:
        name:
            - NotBlank: ~
        mealSchema:
            # Look below

Проверка поля имени работает, а проверка foodSchema - нет, Настройки, которые я уже пробовал безуспешно:

# This one works but assigns error to form instead of field so it's displayed on top of the page
- NotBlank:
    message: Mealtime schema should not be blank

# This doesn't work
- Choice:
    callback: [RecipeMealSchemaChoices, getChoiceKeys] # This method isn't even called
    min: 1
    minMessage: "Please select meal schema"

# This also doesn't work
- Count:
    min: 1
    max: 99
    minMessage: Mealtime schema should not be blank
    maxMessage: Max meal time exceeded

Ответы на вопрос(0)

Ваш ответ на вопрос