Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

Differences Between: [Versions 400 and 403] [Versions 401 and 403] [Versions 402 and 403]

(no description)

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

Defines 1 class


Class: base  - X-Ref

Base class for all report entities

get_default_entity_name()   X-Ref
The default machine-readable name for this entity that will be used in the internal names of the columns/filters

return: string

set_entity_name(string $entityname)   X-Ref
Set entity name

param: string $entityname
return: self

get_entity_name()   X-Ref
Return entity name

return: string

set_entity_title(lang_string $title)   X-Ref
Set entity title

param: lang_string $title
return: self

get_entity_title()   X-Ref
Get entity title

return: lang_string

set_table_alias(string $tablename, string $alias)   X-Ref
Override the default alias for given database table used in entity queries, to avoid table alias clashes that may occur
if multiple entities of a report each define the same default alias for one of their tables

param: string $tablename
param: string $alias
return: self

set_table_aliases(array $aliases)   X-Ref
Override multiple default database table aliases used in entity queries as per {@see set_table_alias}, typically when
you're adding an entity multiple times to a report you'd want to override the table aliases in the second instance to
avoid clashes with the first

param: array $aliases Array of tablename => alias values
return: self

get_table_alias(string $tablename)   X-Ref
Returns an alias used in the queries for a given table

param: string $tablename
return: string

set_table_join_alias(string $tablename, string $alias)   X-Ref
Set the alias for given database table that has already been added to the report. Enables entities to avoid additional
joins on the same table by allowing re-use of existing table aliases in their own queries, {@see has_table_join_alias}

param: string $tablename
param: string $alias
return: self

has_table_join_alias(string $tablename)   X-Ref
Determine whether defined table join alias was specified. Call {@see get_table_alias} to retrieve said value

param: string $tablename
return: bool

add_join(string $join)   X-Ref
Add join clause required for this entity to join to existing tables/entities

param: string $join
return: self

add_joins(array $joins)   X-Ref
Add multiple join clauses required for this entity {@see add_join}

param: string[] $joins
return: self

get_joins()   X-Ref
Return entity joins

return: string[]

get_tag_joins_for_entity(string $component, string $itemtype, string $itemidfield)   X-Ref
Helper method for returning joins necessary for retrieving tags related to the current entity

Both 'tag' and 'tag_instance' aliases must be returned by the entity {@see get_default_table_aliases} method

param: string $component
param: string $itemtype
param: string $itemidfield
return: string[]

add_column(column $column)   X-Ref
Add a column to the entity

param: column $column
return: self

get_columns()   X-Ref
Returns entity columns

return: column[]

get_column(string $name)   X-Ref
Returns an entity column

param: string $name
return: column

add_filter(filter $filter)   X-Ref
Add a filter to the entity

param: filter $filter
return: self

get_filters()   X-Ref
Returns entity filters

return: filter[]

get_filter(string $name)   X-Ref
Returns an entity filter

param: string $name
return: filter

add_condition(filter $condition)   X-Ref
Add a condition to the entity

param: filter $condition
return: $this

get_conditions()   X-Ref
Returns entity conditions

return: filter[]

get_condition(string $name)   X-Ref
Returns an entity condition

param: string $name
return: filter