getResult(); if (!($unit->getResult() instanceof core_kernel_classes_Resource)){ throw new Exception('Unit is not a resource'); } $qtiItem = $this->getQtiService()->getDataItemByRdfItem($resource); $elementReferences = $this->getElementReferencesExtractor() ->extractAll($qtiItem) ->getAllReferences(); if (!empty($elementReferences)) { $ids = $this->getIdDiscoverService()->discover($elementReferences); $this->getItemRelationUpdateService() ->updateByTargetId($resource->getUri(), $ids); } } private function getItemRelationUpdateService(): ItemRelationUpdateService { return $this->getServiceLocator()->get(ItemRelationUpdateService::class); } private function getElementReferencesExtractor(): ElementReferencesExtractor { return $this->getServiceLocator()->get(ElementReferencesExtractor::class); } private function getQtiService(): Service { return $this->getServiceLocator()->get(Service::class); } private function getIdDiscoverService(): IdDiscoverService { return $this->getServiceLocator()->get(IdDiscoverService::class); } }