Is there a possibility to set for example the validation rule “notEmptyString” once throughout the whole application instead of assigning the text to each field of a table individually?
It’s not clear what you are hoping for here. You want every single field in every single table to automatically have the
notEmptyString validation applied to it? That seems very unlikely to actually be useful.
Apologies, didn’t specify properly enough. I meant to ask if i can set a message once, for example “Fill in the required fields” and set this message once globally for the “notEmptyString” method. So that i dont need to go and set this message for each and every notEmptyString validation I have throughout my Tables.
The default message for that comes from
Validator::getNotEmptyMessage. If i18n functions are available, it’ll be the result of
__d('cake', 'This field cannot be left empty'). The easiest way to affect that would be to make a “translation” for this string. Alternately, I guess you could create and use your own Validator class that overrides this one function, or submit a PR to the Cake core to provide a method for changing that string.