19declare(strict_types=1);
33 private readonly AvailabilityPeriodRepository $time_based_activation_properties_repository,
40 if ($object_reference_id ===
null
41 || $object_reference_id === 0) {
45 if (!isset($this->data_cache[$object_reference_id])) {
49 $data = $this->data_cache[$object_reference_id];
53 $data[
'date_of_deletion'],
55 $this->time_based_activation_properties_repository->getFor($object_reference_id)
62 $this->time_based_activation_properties_repository->store(
63 $time_based_activation_property
71 public function preload(array $object_reference_ids): void
73 $this->data_cache += $this->retrieveDataForObjectReferenceIds($object_reference_ids);
74 $this->time_based_activation_properties_repository->preload($object_reference_ids);
79 $this->data_cache = [];
80 $this->reference_properties_repository->resetPreloadedData();
89 $data = $this->retrieveDataForWhereClause($where);
92 throw new \Exception(
'The object with the following reference_id does not exist: '
93 . (
string) $object_reference_id);
96 return $data[$object_reference_id];
105 return $this->retrieveDataForWhereClause($where);
111 .
'ref_id, obj_id, deleted, deleted_by' . PHP_EOL
112 .
'FROM ' . self::REFERENCE_PROPERTIES_TABLE . PHP_EOL
115 $statement = $this->
database->query($query);
116 $num_rows = $this->
database->numRows($statement);
118 if ($num_rows === 0) {
123 while ($row = $this->
database->fetchAssoc($statement)) {
124 $data[$row[
'ref_id']] = [
125 'obj_id' => $row[
'obj_id'],
126 'date_of_deletion' => $row[
'deleted'] !==
null
127 ? new \DateTimeImmutable($row[
'deleted'],
new \DateTimeZone(
'UTC'))
129 'deleted_by' => $row[
'deleted_by']
retrieveDataForObjectReferenceIds(array $object_reference_ids)
preload(array $object_reference_ids)
retrieveDataForObjectReferenceId(int $object_reference_id)
retrieveDataForWhereClause(string $where)
__construct(private readonly AvailabilityPeriodRepository $time_based_activation_properties_repository, private readonly \ilDBInterface $database)
storePropertyAvailabilityPeriod(AvailabilityPeriod $time_based_activation_property)
const REFERENCE_PROPERTIES_TABLE
getFor(?int $object_reference_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...