YAML验证不起作用Symfony2

时间:2015-05-13 11:17:47

标签: php symfony yaml fosuserbundle

我的注册验证有问题。我使用Symfony 2.6FOSUserBundleSonataUserBundle

这是我的AppBundle / Resources / config / validation.yml:

AppBundle\Entity\User:
properties:
    workPhone: - NotBlank: { message: 'Укажите телефон организации', groups: AppRegistration}
    adminPhone: -NotBlank: { message: 'Укажите телефон администратора', groups: AppRegistration}
    name: -NotBlank: { message: 'Укажите название заведения', groups: AppRegistration}
    adress: -NotBlank: { message: 'Укажите адрес заведения', groups: AppRegistration}
    kitchen: -NotBlank : { message: 'Укажите тип кухни', groups: AppRegistration}
    username: -NotBlank: { message: 'Укажите логин', groups: AppRegistration}
    -MinLength: { limit: 4, message: "Логин не должен быть короче {{ limit }} символов", groups: AppRegistration }
    -MaxLength: { limit: 12, message: "Максимальная длина логина {{ limit }} символов", groups: AppRegistration }
    firstname: -NotBlank: { message: 'Укажите имя', groups: AppRegistration}

我的app / config / config.yml:

framework:
    validation:      { enabled: true, enable_annotations: true }
fos_user:
    db_driver: orm 
    firewall_name: main
    user_class: AppBundle\Entity\User
    registration:
       form:
            type: app_bundle_user_registration
            validation_groups: [AppRegistration, Registration]

但使用自定义规则的属性usernamefirstname不起作用! 验证,我在注释工作中添加了perfekt ... Yaml不

0 个答案:

没有答案