ILIAS  trunk Revision v11.0_alpha-1753-gb21ca8c4367
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
DBRepositoryPreloader.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
24 
31 {
35  protected array $preloaded = [];
36 
37  public function __construct(protected \ilDBInterface $db, Repositories $repositories)
38  {
39  parent::__construct($repositories);
40  }
41 
42  #[\Override]
43  public function preload(array $identification_strings): void
44  {
45  $requested = array_diff($identification_strings, $this->preloaded);
46  if ($requested === []) {
47  return;
48  }
49  $r = $this->db->query(
50  "SELECT *, il_resource_revision.title AS revision_title
51 FROM il_resource_revision
52 JOIN il_resource_info ON il_resource_revision.rid = il_resource_info.rid AND il_resource_info.version_number = il_resource_revision.version_number
53 JOIN il_resource ON il_resource_revision.rid = il_resource.rid
54 JOIN il_resource_stkh_u ON il_resource_stkh_u.rid = il_resource.rid
55 JOIN il_resource_stkh ON il_resource_stkh_u.stakeholder_id = il_resource_stkh.id
56 WHERE " . $this->db->in('il_resource_revision.rid', $requested, false, 'text')
57  );
58  while ($d = $this->db->fetchAssoc($r)) {
59  $this->resource_repository->populateFromArray($d);
60  $this->revision_repository->populateFromArray($d);
61  $this->information_repository->populateFromArray($d);
62  $this->stakeholder_repository->populateFromArray($d);
63  }
64  $this->preloaded = array_merge($this->preloaded, $identification_strings);
65  $this->preloaded = array_unique($this->preloaded);
66  }
67 }
__construct(protected \ilDBInterface $db, Repositories $repositories)
__construct(Container $dic, ilPlugin $plugin)
$r