Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Performance helper.

Copyright: 2016 Frédéric Massart - FMCorz.net
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 123 lines (4 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: performance_helper  - X-Ref

Performance helper class.

This tool keeps a local cache of certain items, which means that subsequent
calls to get the resource will not query the database. You will want to use
this when many resources could be shared and need to be queried in a loop.

Note that some of these improvements can only be achieved by knowing the
logic deeper in other modules. For instance we know that a competency's context
is the one of its framework. This tool must be kept in sync with those APIs.

get_context_from_competency(competency $competency)   X-Ref
Get the context of a competency.

return: \context
param: competency $competency The competency.

get_framework_from_competency(competency $competency)   X-Ref
Get the framework of a competency.

return: competency_framework
param: competency $competency The competency.

get_scale_from_competency(competency $competency)   X-Ref
Get the scale of a competency.

/!\ Make sure that this is always kept in sync with:
- core_competency\competency::get_scale()
- core_competency\competency_framework::get_scale()

return: \grade_scale
param: competency $competency The competency.

ingest_framework(competency_framework $framework)   X-Ref
Ingest a framework to avoid additional fetching.

return: void
param: competency_framework $framework The framework.