MDL-56653 enrol_meta: a single DB query in edit_instance_validation
authorVitaly <potenkov@gmail.com>
Fri, 18 Sep 2020 18:45:26 +0000 (21:45 +0300)
committerVitaly <potenkov@gmail.com>
Thu, 12 Nov 2020 12:14:44 +0000 (15:14 +0300)
commitd7d1ed65a5736ab768f818f106eff1bd53ae9935
tree5c7db5c80e63f6b9d0e58cd72f6516a9eb9115bb
parentd330035f1161b96afb08b2c63a9a4df4147f3fcd
MDL-56653 enrol_meta: a single DB query in edit_instance_validation

The 'edit_instance_validation()' method checks for existing meta enrolment instances.
The fix replaces DB queries in a loop for each course with a single query for all courses.
Also, a new testing method 'test_edit_instance_validation_with_existing_courses()'
was added to /enrol/meta/tests/plugin_test.php to test if the new implementation
returns an error in case of trying to save the already linked courses in the 'customint1' field.
enrol/meta/lib.php
enrol/meta/tests/plugin_test.php