Consider the case of a custom file upload.
We can extend the File class and add, let's say, a specific file extension via _getAllowedExtensions
Why we shouldn't be able to add one or more callbacks for validations too ?
At the moment the only way to do it, it's to completely override the beforeSave() function as we have no method (or property) we can use to set an array of additional callbacks.
The method addValidateCallback is called to add only "file size validation"
Description (*)
Consider the case of a custom file upload. We can extend the File class and add, let's say, a specific file extension via _getAllowedExtensions Why we shouldn't be able to add one or more callbacks for validations too ? At the moment the only way to do it, it's to completely override the beforeSave() function as we have no method (or property) we can use to set an array of additional callbacks. The method addValidateCallback is called to add only "file size validation"
Expected behavior (*)
A way to specify additional validation callbacks
Benefits
Cleaner code Less overridden magento code
Additional information