Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 311 and 402] [Versions 311 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: 290 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.