php - Symfony using external parameters in assert and routing -


we working on big symfony2 project should portable , configurable possible. security super important in our project use many validation , on. example use assert in entity , check requirements in routing. example in entity:

  • @assert\range(
    • min = 1,
    • max = 3,
    • minmessage = "common.moderation.status.range_min",
    • maxmessage = "common.moderation.status.range_max"
    • )

and in routing: requirements: status: "[1-3]"

we find way store these range values separately , use them in entities , routes. @ moment these (and other consts) statuses stored in entity constants project grows need more , more constants , fields , routes validation these values cause many duplications this. if 1 of our customers want change range can cause headaches. possible not manually rewrite necessary asserts , route requirements external parameter? thx in advance.

i think should create custom validation constraint.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -