ILIAS  release_7 Revision v7.30-3-g800a261c036
InformationARRepository.php
Go to the documentation of this file.
1<?php declare(strict_types=1);
2
4
8
16{
17
21 public function blank()
22 {
23 return new FileInformation();
24 }
25
29 public function store(Information $information, Revision $revision) : void
30 {
31 $internal = $this->getInternalID($revision);
32 $r = ARInformation::find($internal);
33 if (!$r instanceof ARInformation) {
34 $r = new ARInformation();
35 $r->setInternal($internal);
36 $r->setIdentification($revision->getIdentification()->serialize());
37 $r->create();
38 }
39 $r->setTitle($information->getTitle());
40 $r->setMimeType($information->getMimeType());
41 $r->setSize($information->getSize());
42 $r->setSuffix($information->getSuffix());
43 $r->setCreationDate($information->getCreationDate()->getTimestamp());
44 $r->update();
45 }
46
50 public function get(Revision $revision) : Information
51 {
52 $internal = $this->getInternalID($revision);
53
54 $r = ARInformation::find($internal);
55 $i = new FileInformation();
56 if ($r instanceof ARInformation) {
57 $i->setTitle($r->getTitle());
58 $i->setSize($r->getSize());
59 $i->setMimeType($r->getMimeType());
60 $i->setSuffix($r->getSuffix());
61 $i->setCreationDate((new \DateTimeImmutable())->setTimestamp($r->getCreationDate() ?? 0));
62 }
63
64 return $i;
65 }
66
67 public function delete(Information $information, Revision $revision) : void
68 {
69 $internal = $this->getInternalID($revision);
70 $r = ARInformation::find($internal);
71 if ($r instanceof ARInformation) {
72 $r->delete();
73 }
74 }
75
80 protected function getInternalID(Revision $revision) : string
81 {
82 return $revision->getIdentification()->serialize() . '_' . $revision->getVersionNumber();
83 }
84
85 public function getNamesForLocking() : array
86 {
87 return [
88 (new ARInformation())->getConnectorContainerName()
89 ];
90 }
91
92 public function preload(array $identification_strings) : void
93 {
94 // noting to to
95 }
96
97 public function populateFromArray(array $data) : void
98 {
99 // noting to to
100 }
101
102}
An exception for terminatinating execution or to throw for unit testing.
store(Information $information, Revision $revision)
@inheritDoc
$i
Definition: metadata.php:24
$data
Definition: storeScorm.php:23