Project: moodle
Issue MDL-51506: Implement validation mechanisms in persistent derived classes
We need the models (persistent classes) to be able to validate themselves. The main reason behind this is that we cannot trust the data that is coming from other sources than web services or forms, for instance data manipulated by a developer, data from other sources such as CSV files, etc... The API methods are not the right place to put this validation because the persistent classes can be used directly and enforcing the API use will be very difficult. Defining validation within the model is the first step, later on we could re-use the validation definitions in forms, or even in external functions parameters/return definitions. When working on this, grep for TODOs related to MDL-51506.
Story points: 2