ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
EntityListing.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
27 
28 abstract class EntityListing implements I\EntityListing
29 {
30  use ComponentHelper;
31 
32  protected I\DataRetrieval $data;
33 
34  public function __construct(
35  protected I\RecordToEntity $entity_mapping
36  ) {
37  }
38 
39  public function withData(I\DataRetrieval $data): self
40  {
41  $clone = clone $this;
42  $clone->data = $data;
43  return $clone;
44  }
45 
50  public function getEntities(
51  \ILIAS\UI\Factory $ui_factory,
52  ?Range $range = null,
53  ?array $additional_parameters = null
54  ): \Generator {
55  $mapping = new class ($this->entity_mapping, $ui_factory) implements I\Mapping {
56  public function __construct(
57  protected I\RecordToEntity $mapper,
58  protected \ILIAS\UI\Factory $ui_factory
59  ) {
60  }
61 
62  public function map(mixed $record): IEntity\Entity
63  {
64  return $this->mapper->map($this->ui_factory, $record);
65  }
66  };
67 
68  $additional_parameters = null;
69  return $this->data->getEntities($mapping, $range, $additional_parameters);
70  }
71 }
Interface Observer Contains several chained tasks and infos about them.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getEntities(\ILIAS\UI\Factory $ui_factory, ?Range $range=null, ?array $additional_parameters=null)
__construct(protected I\RecordToEntity $entity_mapping)
A simple class to express a naive range of whole positive numbers.
Definition: Range.php:28