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.

Abstract class for loading records from the DB.

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

Defines 1 class

db_table_vault:: (8 methods):
  __construct()
  get_preprocessors()
  get_db()
  get_entity_factory()
  get_legacy_factory()
  transform_db_records_to_entities()
  get_from_id()
  get_from_ids()


Class: db_table_vault  - X-Ref

Abstract class for loading records from the DB.

__construct(moodle_database $db,entity_factory $entityfactory,$legacyfactory)   X-Ref
Constructor.

param: moodle_database $db A moodle database
param: entity_factory $entityfactory Entity factory
param: object $legacyfactory Legacy factory

get_preprocessors()   X-Ref
Get the list of preprocessors to run on the DB record results. The preprocessors
should be defined using an associative array. The key used to identify the
preprocessor in this list will be used to identify the value of that preprocessor
in the list of results when passed to the from_db_records function.

return: array

get_db()   X-Ref
Get the moodle database.

return: moodle_database

get_entity_factory()   X-Ref
Get the entity factory.

return: entity_factory

get_legacy_factory()   X-Ref
Get the legacy factory

return: object

transform_db_records_to_entities(array $records)   X-Ref
Execute the defined preprocessors on the DB record results and then convert
them into entities.

param: stdClass[] $records List of DB results
return: array

get_from_id(int $id)   X-Ref
Get the entity for the given id.

param: int $id Identifier for the entity
return: object|null

get_from_ids(array $ids)   X-Ref
Get the list of entities for the given ids.

param: int[] $ids Identifiers
return: array