src/xPDO/xPDO.php
public function getObjectGraph($className, $graph, $criteria= null, $cacheFlag= true) {
        $object= null;
        if ($collection= $this->getCollectionGraph($className, $graph, $criteria, $cacheFlag)) {
            if (!count($collection) === 1) {
                $this->log(xPDO::LOG_LEVEL_WARN, 'getObjectGraph criteria returned more than one instance.');
            }
            $object= reset($collection);
        }
        return $object;
    }
public function getObjectGraph($className, $graph, $criteria= null, $cacheFlag= true) {
        $object= null;
        if ($collection= $this->getCollectionGraph($className, $graph, $criteria, $cacheFlag)) {
            if (!count($collection) === 1) {
                $this->log(xPDO::LOG_LEVEL_WARN, 'getObjectGraph criteria returned more than one instance.');
            }
            $object= reset($collection);
        }
        return $object;
    }
public function getObjectGraph ( $ className , $ graph , $ criteria = null , $ cacheFlag = true ) { $ object = null ; if ( $ collection = $ this -> getCollectionGraph ( $ className , $ graph , $ criteria , $ cacheFlag ) ) { if ( ! count ( $ collection ) === 1 ) { $ this -> log ( xPDO :: LOG_LEVEL_WARN , 'getObjectGraph criteria returned more than one instance.' ) ; } $ object = reset ( $ collection ) ; } return $ object ; }
Retrieves an xPDOObject instance with specified related objects.

@uses xPDO::getCollectionGraph()
@param string $className The name of the class to return an instance of.
@param string|array $graph A related object graph in array or JSON
format, e.g. array('relationAlias'=>array('subRelationAlias'=>array()))
or {"relationAlias":{"subRelationAlias":{}}}.  Note that the empty arrays
are necessary in order for the relation to be recognized.
@param mixed $criteria A valid xPDOCriteria instance or expression.
@param boolean|integer $cacheFlag Indicates if the result set should be
cached, and optionally for how many seconds.
@return object The object instance with related objects from the graph
hydrated, or null if no instance can be located by the criteria.
Retrieves an xPDOObject instance with specified related objects .