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.

Forum vault class.

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

Defines 1 class


Class: forum  - X-Ref

Forum vault class.

This should be the only place that accessed the database.

This uses the repository pattern. See:
https://designpatternsphp.readthedocs.io/en/latest/More/Repository/README.html

get_table_alias()   X-Ref
Get the table alias.

return: string

generate_get_records_sql(string $wheresql = null, string $sortsql = null, ?int $userid = null)   X-Ref
Build the SQL to be used in get_records_sql.

param: string|null $wheresql Where conditions for the SQL
param: string|null $sortsql Order by conditions for the SQL
param: int|null $userid The user ID
return: string

get_preprocessors()   X-Ref
Get a list of preprocessors to execute on the DB results before being converted
into entities.

return: array

from_db_records(array $results)   X-Ref
Convert the DB records into forum entities.

param: array $results The DB records
return: forum_entity[]

get_from_course_module_id(int $id)   X-Ref
Get the forum for the given course module id.

param: int $id The course module id
return: forum_entity|null

get_from_course_module_ids(array $ids)   X-Ref
Get the forums for the given course module ids

param: int[] $ids The course module ids
return: forum_entity[]

get_from_post_id(int $id)   X-Ref
Get the forum entity for the given post id.

param: int $id The course module id
return: forum_entity|null