MDL-74497 reportbuilder: Add all columns/filters/conditions at once
This commit is contained in:
@@ -266,4 +266,24 @@ abstract class datasource extends base {
|
||||
|
||||
return $conditions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds all columns/filters/conditions from the given entity to the report at once
|
||||
*
|
||||
* @param string $entityname
|
||||
*/
|
||||
final protected function add_all_from_entity(string $entityname): void {
|
||||
$this->add_columns_from_entity($entityname);
|
||||
$this->add_filters_from_entity($entityname);
|
||||
$this->add_conditions_from_entity($entityname);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds all columns/filters/conditions from all the entities added to the report at once
|
||||
*/
|
||||
final protected function add_all_from_entities(): void {
|
||||
foreach ($this->get_entities() as $entity) {
|
||||
$this->add_all_from_entity($entity->get_entity_name());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -269,6 +269,15 @@ abstract class base {
|
||||
return $this->entities[$name];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of all the entities added to the report
|
||||
*
|
||||
* @return entity_base[]
|
||||
*/
|
||||
final protected function get_entities(): array {
|
||||
return $this->entities;
|
||||
}
|
||||
|
||||
/**
|
||||
* Define a new entity for the report
|
||||
*
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
This file describes API changes in /reportbuilder/*
|
||||
Information provided here is intended especially for developers.
|
||||
|
||||
=== 4.1 ===
|
||||
|
||||
* Added two new methods in the datasource class:
|
||||
- add_all_from_entity() to add all columns/filters/conditions from the given entity to the report at once
|
||||
- add_all_from_entities() to add all columns/filters/conditions from all the entities added to the report at once
|
||||
Reference in New Issue
Block a user