19 declare(strict_types=1);
53 ElementFactory $element_factory,
76 $this->structure->getRoot(),
89 $navigator = $this->navigator_factory->structureNavigator(
91 $this->structure->getRoot()
111 int $id_from_parent_table,
115 throw new \ilMDStructureException(
'LOM Structure is nested to deep.');
119 $tag = $this->
tag($sub);
120 $table = $tag?->table() ??
'';
124 $parent_id = $id_from_parent_table;
126 if (!is_null($result_row)) {
127 $result_rows = [$result_row];
129 if ($table && $result_row?->table() !== $table) {
130 $parent_id = $result_row?->id() ?? 0;
131 $result_rows = $this->querier->read(
138 foreach ($result_rows as $row) {
139 $value = $row->value($tag?->dataField() ??
'');
141 if ($definition->dataType() !==
Type::NULL && $value ===
'') {
156 if (!isset($tag) && count($sub_elements) <= 0) {
160 yield $this->element_factory->element(
180 throw new \ilMDStructureException(
'LOM Structure is nested to deep.');
183 $tag = $this->
tag($struct);
184 if (!is_null($tag) && $table !== $tag?->table()) {
187 if (!is_null($tag)) {
207 $super_step_depths = [];
208 foreach ($path->
steps() as $step) {
211 $super_step_depths[] = $depth;
217 if (empty($super_step_depths)) {
221 $cut_off = min($super_step_depths);
223 $path_builder = $this->path_factory->custom();
224 foreach ($path->
steps() as $step) {
225 if ($depth === $cut_off) {
228 $path_builder = $path_builder->withNextStepFromStep($step);
231 return $path_builder->get();
240 return $struct->getDefinition();
250 yield
from $struct->getSubElements();
253 if ($next_struct = $struct->
nextStep()) {
266 return $this->dictionary->tagForElement($struct);
273 $root_definition = $this->structure->
getRoot()->getDefinition();
274 return $this->element_factory->set(
276 $this->element_factory->root(
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null