mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
Merge branch 'MDL-80430' of https://github.com/paulholden/moodle
This commit is contained in:
commit
443871d320
8
.upgradenotes/MDL-80430-2024083015011365.yml
Normal file
8
.upgradenotes/MDL-80430-2024083015011365.yml
Normal file
@ -0,0 +1,8 @@
|
||||
issueNumber: MDL-80430
|
||||
notes:
|
||||
core_reportbuilder:
|
||||
- message: >-
|
||||
Final removal of support for `get_default_table_aliases` method.
|
||||
Entities must now implement `get_default_tables`, which is now abstract,
|
||||
to define the tables they use
|
||||
type: removed
|
@ -57,40 +57,18 @@ abstract class base {
|
||||
private $conditions = [];
|
||||
|
||||
/**
|
||||
* Database tables that this entity uses
|
||||
*
|
||||
* Must be overridden by the entity to list all database tables that it expects to be present in the main
|
||||
* SQL or in JOINs added to this entity
|
||||
*
|
||||
* @todo in Moodle 4.8 - make abstract when support for {@see get_default_table_aliases} is finally removed
|
||||
* Database tables that the entity expects to be present in the main SQL or in JOINs added to it
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
protected function get_default_tables(): array {
|
||||
static $debuggingshown;
|
||||
|
||||
// The default implementation falls back to retrieving deprecated table aliases to determine our table names.
|
||||
$tablenamealiases = $this->get_default_table_aliases();
|
||||
if (!empty($tablenamealiases) && !$debuggingshown) {
|
||||
debugging('The function get_default_table_aliases() is deprecated, please define the entity' .
|
||||
' tables with get_default_tables() in ' . static::class, DEBUG_DEVELOPER);
|
||||
|
||||
// Don't be too spammy with the debugging, this method is called multiple times per entity load.
|
||||
$debuggingshown = true;
|
||||
}
|
||||
|
||||
return array_keys($tablenamealiases);
|
||||
}
|
||||
abstract protected function get_default_tables(): array;
|
||||
|
||||
/**
|
||||
* Database tables that this entity uses and their default aliases (note that these aliases are now ignored)
|
||||
*
|
||||
* @return string[] Array of $tablename => $alias
|
||||
*
|
||||
* @deprecated since Moodle 4.4 - aliases are now autogenerated, please implement {@see get_default_tables} instead
|
||||
*/
|
||||
protected function get_default_table_aliases(): array {
|
||||
return [];
|
||||
#[\core\attribute\deprecated('::get_default_tables', since: '4.4', mdl: 'MDL-79397', final: true)]
|
||||
protected function get_default_table_aliases(): void {
|
||||
\core\deprecation::emit_deprecation_if_present([self::class, __FUNCTION__]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user