ILIAS  release_8 Revision v8.24
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 protected \ilDBInterface $db;
37
38 public function __construct(\ilDBInterface $db, Repositories $repositories)
39 {
40 $this->db = $db;
41 parent::__construct($repositories);
42 }
43
44 public function preload(array $identification_strings): void
45 {
46 $requested = array_diff($identification_strings, $this->preloaded);
47 if ($requested === []) {
48 return;
49 }
50 $r = $this->db->query(
51 "SELECT *, il_resource_revision.title AS revision_title
52FROM il_resource_revision
53JOIN il_resource_info ON il_resource_revision.rid = il_resource_info.rid AND il_resource_info.version_number = il_resource_revision.version_number
54JOIN il_resource ON il_resource_revision.rid = il_resource.rid
55JOIN il_resource_stkh_u ON il_resource_stkh_u.rid = il_resource.rid
56JOIN il_resource_stkh ON il_resource_stkh_u.stakeholder_id = il_resource_stkh.id
57WHERE " . $this->db->in('il_resource_revision.rid', $requested, false, 'text')
58 );
59 while ($d = $this->db->fetchAssoc($r)) {
60 $this->resource_repository->populateFromArray($d);
61 $this->revision_repository->populateFromArray($d);
62 $this->information_repository->populateFromArray($d);
63 $this->stakeholder_repository->populateFromArray($d);
64 }
65 $this->preloaded = array_merge($this->preloaded, $identification_strings);
66 $this->preloaded = array_unique($this->preloaded);
67 }
68}
__construct(\ilDBInterface $db, Repositories $repositories)
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296
Interface ilDBInterface.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc