Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-82068

Re-factor SQL JOIN related class implementations into common trait

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • 4.5
    • 4.5
    • Report builder

      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:

      1. https://github.com/moodle/moodle/blob/bcd8e0d6edd9b07fce5de47283befcec491d3a19/reportbuilder/classes/local/entities/base.php#L256-L287
      2. https://github.com/moodle/moodle/blob/bcd8e0d6edd9b07fce5de47283befcec491d3a19/reportbuilder/classes/local/helpers/custom_fields.php#L70-L101
      3. https://github.com/moodle/moodle/blob/bcd8e0d6edd9b07fce5de47283befcec491d3a19/reportbuilder/classes/local/helpers/user_profile_fields.php#L81-L113
      4. https://github.com/moodle/moodle/blob/bcd8e0d6edd9b07fce5de47283befcec491d3a19/reportbuilder/classes/local/report/column.php#L254-L290
      5. 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

            pholden Paul Holden
            pholden Paul Holden
            Carlos Castillo Carlos Castillo
            David Carrillo David Carrillo
            CiBoT CiBoT
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 46 minutes
                46m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.