In the main Yii2 application, how can we add validation rules to a Module (or an ActiveRecord) that comes with a 3rd party module?
Can we modify existing rules? Say we have the following rule:
['currency', 'in', 'range' => ['USD', 'GBP', 'EUR']],
How would we add or remove any currencies inside the 'range' array?
Keep in mind that we cannot simply extend the class and override rules()
since that would not change the parent class that the module is using. If the above is impossible, please shed some light on a proper way to design a module to support validation rule customization in its models/activerecords.
EDIT 2021: Upon revisiting this question ... Just don't do this. It may seem like the right approach, but it's not. You will end up pulling your hair out when you are getting mysterious validation errors that you have no idea where they are coming from.