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

c# - How do I debug "System.DllNotFoundException: The specified procedure could not be found"? -

javascript - Can Piwik report referrer in real time? -

mysql - FireDac error 314 - but DLLs are in program directory -