You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Done. From now on, my registration form validates the password field against 8 characters.
But now I also need to add a form extension to ChangePasswordType and ResetPasswordType because they don't validate new data on entity level. This is pure pain.
Only if a form contains a corresponding data class, the validation gets dispatched automatically. So adding a validation before saving a customer could solve this:
$this->get('validator')->validate($customer)
Mission
Find a consistent way for all forms and entities, so we can easily modify or extend validations:
Custom coreshop form / entity validation configuration for example
Add validation(Via Validator) in every action if no form data class is available for example
The text was updated successfully, but these errors were encountered:
You are talking about very specific form-types. ChangePasswordType and ResetPasswordType are some sort of special forms and a Customer constraint will never work for them.
ResetPasswordType
Doesn't have a customer, we could introduce a new DTO like with AddToCart to add validations to that model.
ChangePasswordType
Does have a relation to a customer, but we also need to validate for the current password, which we do with a constraint already. If we change that to a custom DTO model (eg. ChangePasswordRequest) we could also make the configuration with YML.
There are a lot of validation / constraint stuff in coreshop and sometimes there are some annoying mismatches.
For example, I want to improve the customers
password
field constraints in the whole ecosystem. I'm starting with the customer entity:Done. From now on, my registration form validates the password field against 8 characters.
But now I also need to add a form extension to
ChangePasswordType
andResetPasswordType
because they don't validate new data on entity level. This is pure pain.Only if a form contains a corresponding data class, the validation gets dispatched automatically. So adding a validation before saving a customer could solve this:
Mission
Find a consistent way for all forms and entities, so we can easily modify or extend validations:
The text was updated successfully, but these errors were encountered: