Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

(no description)

File Size: 158 lines (5 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

context_repository:: (8 methods):
  context_from_record()
  record_from_context()
  save()
  find()
  find_by_contextid()
  exists()
  delete()
  delete_by_deployment()


Class: context_repository  - X-Ref

Class context_repository.

context_from_record(\stdClass $record)   X-Ref
Generate a context instance from a record.

param: \stdClass $record the record.
return: context the context instance.

record_from_context(context $context)   X-Ref
Generate a record from a context instance.

param: context $context the context instance.
return: \stdClass the resulting record.

save(context $context)   X-Ref
Save the context to the store.

param: context $context the context to save.
return: context the saved context instance.

find(int $id)   X-Ref
Find a context by id.

param: int $id the id of the instance.
return: context|null the context, if found, else null.

find_by_contextid(string $contextid, int $deploymentid)   X-Ref
Find a context by it's platform-issued context id string.

param: string $contextid the id of the context on the platform.
param: int $deploymentid the id of the local deployment instance in which the contextid is unique.
return: context|null the context instance, if found, else null.

exists(int $id)   X-Ref
Check whether the context identified by 'id' exists in the store.

param: int $id the id of the instance to check.
return: bool true if found, false otherwise.

delete(int $id)   X-Ref
Delete the context identified by 'id' from the store.

param: int $id the id of context to delete.

delete_by_deployment(int $deploymentid)   X-Ref
Delete all contexts under a given deployment.

param: int $deploymentid the id of the local deployment instance.