Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
core_competency\external\performance_helper Class Reference

Performance helper class. More...

Public Member Functions

 get_context_from_competency (competency $competency)
 Get the context of a competency.
 
 get_framework_from_competency (competency $competency)
 Get the framework of a competency.
 
 get_scale_from_competency (competency $competency)
 Get the scale of a competency.
 
 ingest_framework (competency_framework $framework)
 Ingest a framework to avoid additional fetching.
 

Protected Attributes

competency_framework $frameworks = []
 Cache of frameworks by framework ID.
 
context $frameworkscontexts = []
 Cache of contexts by framework ID.
 
grade_scale[] $scales = []
 Cache of scales by scale ID.
 

Detailed Description

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.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ get_context_from_competency()

core_competency\external\performance_helper::get_context_from_competency ( competency $competency)

Get the context of a competency.

Parameters
competency$competencyThe competency.
Return values
context

◆ get_framework_from_competency()

core_competency\external\performance_helper::get_framework_from_competency ( competency $competency)

Get the framework of a competency.

Parameters
competency$competencyThe competency.
Return values
competency_framework

◆ get_scale_from_competency()

core_competency\external\performance_helper::get_scale_from_competency ( competency $competency)

Get the scale of a competency.

/!:: Make sure that this is always kept in sync with:

Parameters
competency$competencyThe competency.
Return values
grade_scale

◆ ingest_framework()

core_competency\external\performance_helper::ingest_framework ( competency_framework $framework)

Ingest a framework to avoid additional fetching.

Parameters
competency_framework$frameworkThe framework.
Return values
void

The documentation for this class was generated from the following file: