-
Improvement
-
Resolution: Fixed
-
Minor
-
4.5
-
MOODLE_405_STABLE
-
MOODLE_405_STABLE
-
- Covered by automated tests
Currently we implement API like the following in multiple classes:
- public function add_join(string $join): self
- public function add_joins(array $joins): self
- public function get_joins(): array
This makes it awkward to change that behaviour, because we've implemented it in so many disparate places. Re-factor all of it into a trait that can replace most current implementations:
- https://github.com/moodle/moodle/blob/bcd8e0d6edd9b07fce5de47283befcec491d3a19/reportbuilder/classes/local/entities/base.php#L256-L287
- https://github.com/moodle/moodle/blob/bcd8e0d6edd9b07fce5de47283befcec491d3a19/reportbuilder/classes/local/helpers/custom_fields.php#L70-L101
- https://github.com/moodle/moodle/blob/bcd8e0d6edd9b07fce5de47283befcec491d3a19/reportbuilder/classes/local/helpers/user_profile_fields.php#L81-L113
- https://github.com/moodle/moodle/blob/bcd8e0d6edd9b07fce5de47283befcec491d3a19/reportbuilder/classes/local/report/column.php#L254-L290
- https://github.com/moodle/moodle/blob/bcd8e0d6edd9b07fce5de47283befcec491d3a19/reportbuilder/classes/local/report/filter.php#L165-L202
Update accompanying tests, to also ensure we aren't duplicating testcase methods of this functionality (just test the trait)
As we're also improving/modernising the code here, use it as an opportunity to implement constructor property promotion on the classes we are updating anyway, to help clarify properties of each instance
- has a non-specific relationship to
-
MDL-84639 Replace usage of deprecated getObjectForTrait mocking
-
- Closed
-