Implemented getObjectNode as well, renamed other function for consistency

This commit is contained in:
2026-05-15 10:58:54 +00:00
parent 0cb2655494
commit 1122b9faf5
2 changed files with 18 additions and 2 deletions

View File

@@ -66,7 +66,7 @@ class CloudObject {
/**
* Get the object node encapsulated in this CloudObject.
*/
public function getObjectNode() : Node {
public function getAsNode() : Node {
return $this->node;
}
@@ -133,4 +133,20 @@ class CloudObject {
return $this->retriever->getCloudObject($coid);
}
/**
* Get the value of a property and, if it's a COID, retrieve the corresponding object node.
*/
public function getObjectNode($property) : ?Node {
Assert::notNull($this->retriever, "No ObjectRetriever set for CloudObject. Cannot retrieve related object.");
$coid = $this->getReader()->getFirstValueIRI($this->node, $property);
if (!($coid instanceof IRI)) {
return null;
}
return $this->retriever->getObjectNode($coid);
}
}