Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Protected Member Functions | List of all members
mod_forum\local\vaults\forum Class Reference

Forum vault class. More...

Inheritance diagram for mod_forum\local\vaults\forum:
mod_forum\local\vaults\db_table_vault

Public Member Functions

 get_from_course_module_id (int $id)
 Get the forum for the given course module id. More...
 
 get_from_course_module_ids (array $ids)
 Get the forums for the given course module ids. More...
 
 get_from_id (int $id)
 Get the entity for the given id. More...
 
 get_from_ids (array $ids)
 Get the list of entities for the given ids. More...
 
 get_from_post_id (int $id)
 Get the forum entity for the given post id. More...
 

Protected Member Functions

 from_db_records (array $results)
 Convert the DB records into forum entities. More...
 
 generate_get_records_sql (string $wheresql=null, string $sortsql=null, ?int $userid=null)
 Build the SQL to be used in get_records_sql. More...
 
 get_db ()
 Get the moodle database. More...
 
 get_entity_factory ()
 Get the entity factory. More...
 
 get_legacy_factory ()
 Get the legacy factory. More...
 
 get_preprocessors ()
 Get a list of preprocessors to execute on the DB results before being converted into entities. More...
 
 get_table_alias ()
 Get the table alias. More...
 
 transform_db_records_to_entities (array $records)
 Execute the defined preprocessors on the DB record results and then convert them into entities. More...
 

Detailed Description

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

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ from_db_records()

mod_forum\local\vaults\forum::from_db_records ( array  $results)
protected

Convert the DB records into forum entities.

Parameters
array$resultsThe DB records
Return values
forum_entity[]

Reimplemented from mod_forum\local\vaults\db_table_vault.

◆ generate_get_records_sql()

mod_forum\local\vaults\forum::generate_get_records_sql ( string  $wheresql = null,
string  $sortsql = null,
?int  $userid = null 
)
protected

Build the SQL to be used in get_records_sql.

Parameters
string | null$wheresqlWhere conditions for the SQL
string | null$sortsqlOrder by conditions for the SQL
int | null$useridThe user ID
Return values
string

Reimplemented from mod_forum\local\vaults\db_table_vault.

◆ get_db()

mod_forum\local\vaults\db_table_vault::get_db ( )
protectedinherited

Get the moodle database.

Return values
moodle_database

◆ get_entity_factory()

mod_forum\local\vaults\db_table_vault::get_entity_factory ( )
protectedinherited

Get the entity factory.

Return values
entity_factory

◆ get_from_course_module_id()

mod_forum\local\vaults\forum::get_from_course_module_id ( int  $id)

Get the forum for the given course module id.

Parameters
int$idThe course module id
Return values
forum_entity|null

◆ get_from_course_module_ids()

mod_forum\local\vaults\forum::get_from_course_module_ids ( array  $ids)

Get the forums for the given course module ids.

Parameters
int[]$idsThe course module ids
Return values
forum_entity[]

◆ get_from_id()

mod_forum\local\vaults\db_table_vault::get_from_id ( int  $id)
inherited

Get the entity for the given id.

Parameters
int$idIdentifier for the entity
Return values
object|null

◆ get_from_ids()

mod_forum\local\vaults\db_table_vault::get_from_ids ( array  $ids)
inherited

Get the list of entities for the given ids.

Parameters
int[]$idsIdentifiers
Return values
array

◆ get_from_post_id()

mod_forum\local\vaults\forum::get_from_post_id ( int  $id)

Get the forum entity for the given post id.

Parameters
int$idThe course module id
Return values
forum_entity|null

◆ get_legacy_factory()

mod_forum\local\vaults\db_table_vault::get_legacy_factory ( )
protectedinherited

Get the legacy factory.

Return values
object

◆ get_preprocessors()

mod_forum\local\vaults\forum::get_preprocessors ( )
protected

Get a list of preprocessors to execute on the DB results before being converted into entities.

Return values
array

Reimplemented from mod_forum\local\vaults\db_table_vault.

◆ get_table_alias()

mod_forum\local\vaults\forum::get_table_alias ( )
protected

Get the table alias.

Return values
string

Reimplemented from mod_forum\local\vaults\db_table_vault.

◆ transform_db_records_to_entities()

mod_forum\local\vaults\db_table_vault::transform_db_records_to_entities ( array  $records)
protectedinherited

Execute the defined preprocessors on the DB record results and then convert them into entities.

Parameters
stdClass[]$recordsList of DB results
Return values
array

The documentation for this class was generated from the following file: