Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

Differences Between: [Versions 310 and 403] [Versions 311 and 403] [Versions 39 and 403] [Versions 400 and 403] [Versions 401 and 403]

Contains event class for providing the related objects when exporting a list of calendar events.

Copyright: 2017 Ryan Wyllie <ryan@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 288 lines (9 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

events_related_objects_cache:: (9 methods):
  __construct()
  get_course()
  get_context()
  get_group()
  get_course_module()
  get_module_instance()
  load_courses()
  load_groups()
  load_module_instances()


Class: events_related_objects_cache  - X-Ref

Class to providing the related objects when exporting a list of calendar events.

This class is only meant for use with exporters. It attempts to bulk load
the related objects for a list of events and cache them to avoid having
to query the database when exporting each individual event.

__construct(array $events, array $courses = null)   X-Ref
Constructor.

param: array $events Array of event_interface events
param: array $courses Array of courses to populate the cache with

get_course(event_interface $event)   X-Ref
Get the related course object for a given event.

param: event_interface $event The event object.
return: \stdClass|null

get_context(event_interface $event)   X-Ref
Get the related context for a given event.

param: event_interface $event The event object.
return: \context|null

get_group(event_interface $event)   X-Ref
Get the related group object for a given event.

param: event_interface $event The event object.
return: \stdClass|null

get_course_module(event_interface $event)   X-Ref
Get the related course module for a given event.

param: event_interface $event The event object.
return: \stdClass|null

get_module_instance(event_interface $event)   X-Ref
Get the related module instance for a given event.

param: event_interface $event The event object.
return: \stdClass|null

load_courses()   X-Ref
Load the list of all of the distinct courses required for the
list of provided events and save the result in memory.


load_groups()   X-Ref
Load the list of all of the distinct groups required for the
list of provided events and save the result in memory.


load_module_instances()   X-Ref
Load the list of all of the distinct module instances required for the
list of provided events and save the result in memory.