ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
DBRepositoryPreloader.php
Go to the documentation of this file.
1<?php
2
19declare(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
51FROM il_resource_revision
52JOIN il_resource_info ON il_resource_revision.rid = il_resource_info.rid AND il_resource_info.version_number = il_resource_revision.version_number
53JOIN il_resource ON il_resource_revision.rid = il_resource.rid
54JOIN il_resource_stkh_u ON il_resource_stkh_u.rid = il_resource.rid
55JOIN il_resource_stkh ON il_resource_stkh_u.stakeholder_id = il_resource_stkh.id
56WHERE " . $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)
Interface ilDBInterface.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc