Replies: 1 comment
-
We usually add a event listener and run the Symfony Validator there. We configure symfony validations then for that object. I guess that is something Pimcore could do in core. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I haven't been working with Pimcore for a long time but found the need to add validation to a text data type (input) a few times. Right now I do this by hooking on to the PRE_ADD and/or PRE_UPDATE events and throwing a ValidationException when things aren't right.
I was thinking maybe we can add an option to Pimcore where you can add one or more constraints to a data type in your class definition. This would consist simply of the FQCN of a constraint + the option to apply this on creation and/or saving. This way you can easily use Symfony's constraints or your own custom constraints.
What do you guys think? If you think it's a good idea; technically I'm thinking to still solve this with an event listener, but perhaps it's better to just check for constraints on the data object directly.
Beta Was this translation helpful? Give feedback.
All reactions