mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 17:06:53 +02:00
MDL-79397 reportbuilder: update reports to use auto-generated aliases.
We no longer need to be concerned about the manual setting of entity table aliases (e.g. to avoid duplication between entities, or for using a single entity multiple times), as it's handled transparently for us.
This commit is contained in:
parent
7143cf4cbc
commit
3dec3fb8ce
3 changed files with 17 additions and 22 deletions
|
@ -68,17 +68,14 @@ class notes extends datasource {
|
|||
ON {$recipientalias}.id = {$postalias}.userid")
|
||||
);
|
||||
|
||||
// Join the user entity to represent the note author. Override all entity table aliases to avoid clash with first instance.
|
||||
// Join the user entity to represent the note author.
|
||||
$authorentity = (new user())
|
||||
->set_entity_name('author')
|
||||
->set_entity_title(new lang_string('author', 'core_notes'))
|
||||
->set_table_aliases([
|
||||
'user' => 'au',
|
||||
'context' => 'auctx',
|
||||
]);
|
||||
->set_entity_title(new lang_string('author', 'core_notes'));
|
||||
$authoralias = $authorentity->get_table_alias('user');
|
||||
$this->add_entity($authorentity->add_join("
|
||||
LEFT JOIN {user} au
|
||||
ON au.id = {$postalias}.usermodified")
|
||||
LEFT JOIN {user} {$authoralias}
|
||||
ON {$authoralias}.id = {$postalias}.usermodified")
|
||||
);
|
||||
|
||||
// Join the course entity for course notes.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue