ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
LOMDatabaseRepository.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
34
36{
43
44 public function __construct(
51 ) {
52 $this->ressource_factory = $ressource_factory;
53 $this->manipulator = $manipulator;
54 $this->reader = $reader;
55 $this->searcher = $searcher;
56 $this->processor = $processor;
57 $this->identifier_handler = $identifier_handler;
58 }
59
60 public function getMD(
61 int $obj_id,
62 int $sub_id,
63 string $type
64 ): SetInterface {
65 return $this->processor->finishAndCleanData(
66 $this->reader->getMD(
67 $this->ressource_factory->ressourceID($obj_id, $sub_id, $type)
68 )
69 );
70 }
71
72 public function getMDOnPath(
74 int $obj_id,
75 int $sub_id,
76 string $type
77 ): SetInterface {
78 return $this->processor->finishAndCleanData(
79 $this->reader->getMDOnPath(
80 $path,
81 $this->ressource_factory->ressourceID($obj_id, $sub_id, $type)
82 )
83 );
84 }
85
89 public function searchMD(
90 ClauseInterface $clause,
91 ?int $limit,
92 ?int $offset,
93 FilterInterface ...$filters
94 ): \Generator {
95 yield from $this->searcher->search($clause, $limit, $offset, ...$filters);
96 }
97
98 public function manipulateMD(SetInterface $set): void
99 {
100 $this->processor->checkMarkers($set);
101 $this->manipulator->manipulateMD($set);
102 }
103
104 public function transferMD(
105 SetInterface $from_set,
106 int $to_obj_id,
107 int $to_sub_id,
108 string $to_type,
109 bool $throw_error_if_invalid
110 ): void {
111 $to_ressource_id = $this->ressource_factory->ressourceID($to_obj_id, $to_sub_id, $to_type);
112
113 if ($throw_error_if_invalid) {
114 $this->processor->checkMarkers($from_set);
115 } else {
116 $this->processor->cleanMarkers($from_set);
117 }
118 $from_set = $this->identifier_handler->prepareUpdateOfIdentifier($from_set, $to_ressource_id);
119 $this->manipulator->deleteAllMD($to_ressource_id);
120 $this->manipulator->transferMD($from_set, $to_ressource_id);
121 }
122
123 public function deleteAllMD(
124 int $obj_id,
125 int $sub_id,
126 string $type
127 ): void {
128 $this->manipulator->deleteAllMD(
129 $this->ressource_factory->ressourceID($obj_id, $sub_id, $type)
130 );
131 }
132}
deleteAllMD(int $obj_id, int $sub_id, string $type)
transferMD(SetInterface $from_set, int $to_obj_id, int $to_sub_id, string $to_type, bool $throw_error_if_invalid)
Transfers a metadata set to an object, regardless of its source.
__construct(RessourceIDFactoryInterface $ressource_factory, DatabaseManipulatorInterface $manipulator, DatabaseReaderInterface $reader, DatabaseSearcherInterface $searcher, ProcessorInterface $processor, IdentifierHandlerInterface $identifier_handler)
getMDOnPath(PathInterface $path, int $obj_id, int $sub_id, string $type)
Returns an MD set with only the elements specified on a path, and all nested subelements of the last ...
getMD(int $obj_id, int $sub_id, string $type)
searchMD(ClauseInterface $clause, ?int $limit, ?int $offset, FilterInterface ... $filters)
manipulateMD(SetInterface $set)
Follows a trail of markers from the root element, and creates, updates or deletes marked MD elements ...
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$path
Definition: ltiservices.php:30