First implementation of a new CloudObject node wrapper class
This commit is contained in:
@@ -170,15 +170,34 @@ class ObjectRetriever implements CustomCacheAndLogInterface {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an object description from CloudObjects. Attempts to get object
|
||||
* from in-memory cache first, stored static configurations next,
|
||||
* configured external cache third, and finally calls the Object API
|
||||
* on CloudObjects Core. Returns null if the object was not found.
|
||||
* Get an object description and return a CloudObject.
|
||||
*/
|
||||
public function getCloudObject(IRI $coid) {
|
||||
$node = $this->getObjectNode($coid);
|
||||
if (!$node) {
|
||||
// Object not found
|
||||
return null;
|
||||
}
|
||||
|
||||
return new CloudObject($coid, $node);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an object description and return a node.
|
||||
*
|
||||
* @deprecated Use getObjectNode() instead
|
||||
*/
|
||||
public function getObject(IRI $coid) {
|
||||
return $this->getObjectNode($coid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an object description from CloudObjects and return a node.
|
||||
*
|
||||
* @param IRI $coid COID of the object
|
||||
* @return Node|null
|
||||
*/
|
||||
public function getObject(IRI $coid) {
|
||||
public function getObjectNode(IRI $coid) {
|
||||
if (!COIDParser::isValidCOID($coid))
|
||||
throw new Exception("Not a valid COID.");
|
||||
|
||||
@@ -394,10 +413,11 @@ class ObjectRetriever implements CustomCacheAndLogInterface {
|
||||
|
||||
/**
|
||||
* Get an object description from CloudObjects. Shorthand method for
|
||||
* "getObject" which allows passing the COID as string instead of IRI.
|
||||
* "getObjectNode" which allows passing the COID as string instead of IRI.
|
||||
*
|
||||
* @param any $coid
|
||||
* @return Node|null
|
||||
* @deprecated Interface may change
|
||||
*/
|
||||
public function get($coid) {
|
||||
if (is_string($coid))
|
||||
@@ -425,7 +445,7 @@ class ObjectRetriever implements CustomCacheAndLogInterface {
|
||||
$ts = microtime(true);
|
||||
|
||||
$cacheId = $object->getId().'#'.$filename;
|
||||
$fileData = $this->getFromCache($cacheId);
|
||||
$fileData = $this->getFromCache($cacheId);
|
||||
|
||||
// Parse cached data into revision and content
|
||||
if (isset($fileData)) {
|
||||
|
||||
Reference in New Issue
Block a user