This commit is contained in:
Huong Nguyen 2024-11-21 10:56:48 +07:00
commit 443871d320
No known key found for this signature in database
GPG Key ID: 40D88AB693A3E72A
2 changed files with 13 additions and 27 deletions

View 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

View File

@ -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__]);
}
/**