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

Persistent method 'get' does not return the correct type

    XMLWordPrintable

Details

    • 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    

    Description

      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

      Attachments

        Issue Links

          Activity

            People

              davidmatamoros David Matamoros
              davidmatamoros David Matamoros
              Paul Holden Paul Holden
              Andrew Lyons Andrew Lyons
              CiBoT CiBoT
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              1 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                19/Apr/22

                Time Tracking

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