简体   繁体   中英

Symfony2: Dependence of getter validator on other validators

I am using YML as my validation config format and now have the following setup:

properties:
    user_id:
        - NotBlank:
            message: "Please provide an user id"

    ...

getters:
    newUser:
        - "True":
            message: "You already have participated!"

    ...

So basically, I have two validators for my user_id field:

  1. check, whether it is not blank
  2. does some more advanced checks, (the user may not yet exist)

I don't have to validate the second condition, if the first already failed. Is there some possibility to say, that the newUser test depends on the NotBlank test?

(for example with an additional flag like depends: user_id.NotBlank or something like that)

似乎当前不支持此功能。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM