Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
mod_forum\local\vaults\author Class Reference

Author vault class. More...

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

Public Member Functions

 get_authors_for_posts (array $posts)
 Get the authors for the given posts.
 
 get_context_ids_for_author_ids (array $authorids)
 Get the context ids for a set of author ids.
 
 get_from_id (int $id)
 Get the entity for the given id.
 
 get_from_ids (array $ids)
 Get the list of entities for the given ids.
 

Protected Member Functions

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

Detailed Description

Author 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\author::from_db_records ( array $results)
protected

Convert the DB records into author entities.

Parameters
array$resultsThe DB records
Return values
author_entity[]

Reimplemented from mod_forum\local\vaults\db_table_vault.

◆ generate_get_records_sql()

mod_forum\local\vaults\author::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_authors_for_posts()

mod_forum\local\vaults\author::get_authors_for_posts ( array $posts)

Get the authors for the given posts.

Returns a distinct list of authors indexed by author id.

Parameters
post_entity[]$postsThe list of posts
Return values
author_entity[]

◆ get_context_ids_for_author_ids()

mod_forum\local\vaults\author::get_context_ids_for_author_ids ( array $authorids)

Get the context ids for a set of author ids.

The results are indexed by the author id.

Parameters
int[]$authoridsThe list of author ids to fetch.
Return values
int[]Results indexed by author id.

◆ 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_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_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\db_table_vault::get_preprocessors ( )
protectedinherited

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 values
array

Reimplemented in mod_forum\local\vaults\discussion_list, and mod_forum\local\vaults\forum.

◆ get_table_alias()

mod_forum\local\vaults\author::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: