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

Persistent method 'get' does not return the correct type

XMLWordPrintable

    • MOODLE_311_STABLE
    • MOODLE_400_STABLE
    • MDL-72329-master
    • Hide

      Covered by unit tests:

      vendor/bin/phpunit --filter core_persistent_testcase
      

       

      We removed the custom getter from ReportBuilder and these tests should pass too:

      vendor/bin/phpunit --filter system_report_exporter_testcase
      

       

       

      Show
      Covered by unit tests: vendor/bin/phpunit --filter core_persistent_testcase   We removed the custom getter from ReportBuilder and these tests should pass too: vendor/bin/phpunit --filter system_report_exporter_testcase    

      The 'get' method in persistents does not return the property with the correct type, even if it has been defined in the persistent definition. If for example we have property 'id' and we set it as int, persistent should cast the property to int before return it.

      We encountered this problem in Workplace plugins and recently in Reportbuilder component. Here is an example of what we need to do to solve this issue:

      https://github.com/moodle/moodle/blob/0d0e66d37c6271657d76f948db9eeb10c139e7ae/reportbuilder/classes/local/models/report.php#L84-L91

            davidcarrillo David Carrillo
            davidcarrillo David Carrillo
            Paul Holden Paul Holden
            Andrew Lyons Andrew Lyons
            CiBoT CiBoT
            Votes:
            1 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day, 10 minutes
                1d 10m

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