php - How to Add a check Constraint to Doctrine Annotation in Symfony -


suppose have field gender in person entity can take of following values

  • male
  • female
  • others

how can provide check using doctrine orm annotation , create corresponding radio button in form using php app/console generate:doctrine:crud?

can directly? or have rely on manual approach?

you can specify valid choices using choice constraint orm annotation entity property. symfony book uses gender example.

in case array {"male", "female", "other"}, , may not want validation error message.

as validation in annotation format need enable annotation validation in symfony app configuration (config.yml), believe still disabled default.


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

python - build a suggestions list using fuzzywuzzy -