public function load($type, $id)
    {
        $driver = $this->_toolbox->getDriver();

        try {
            if ($this->_toolbox->isGraph()) {

                switch (strtolower($type)) {

                    case "vertex":

                        if ($this->hasTransaction()) {
                            $this->_toolbox->getTransactionManager()->addReadCollection($this->_toolbox->getVertexCollectionName());
                            $this->addTransactionCommand("function () {var temp = graph.getVertex('$id'); return temp ? temp._properties : null}();", "PodManager:load", null, true, array('type' => $type));
                        } else {
                            $vertex = $driver->getVertex($this->_toolbox->getGraph(), $id);

                            return $this->convertDriverDocumentToPod($vertex);
                        }
                        break;

                    case "edge":

                        if ($this->hasTransaction()) {
                            $this->_toolbox->getTransactionManager()->addReadCollection($this->_toolbox->getEdgeCollectionName());
                            $this->addTransactionCommand("graph.getEdge('$id')._properties;", "PodManager:load", null, true, array('type' => $type));
                        } else {
                            $edge = $driver->getEdge($this->_toolbox->getGraph(), $id);

                            return $this->convertDriverDocumentToPod($edge);
                        }
                        break;

                    default:
                        throw new PodManagerException("For graphs, only the types 'vertex' and 'edge' can be loaded.");
                }

            } else {

                if ($this->hasTransaction()) {
                    $this->_toolbox->getTransactionManager()->addReadCollection($type);
                    $this->addTransactionCommand("db.$type.document('$id');", "PodManager:load", null, false, array('type' => $type));
                } else {
                    $document = $driver->getById($type, $id);

                    return $this->convertDriverDocumentToPod($document);
                }

            }
        } catch (\Exception $e) {

            //Rethrow the exception from the try block
            if ($e instanceof PodManagerException) {
                throw $e;

            //Otherwise just return a null if the pod does not exist, or if there is an error.
            } else {
                return null;
            }
        }

    }
public function load($type, $id)
    {
        $driver = $this->_toolbox->getDriver();

        try {
            if ($this->_toolbox->isGraph()) {

                switch (strtolower($type)) {

                    case "vertex":

                        if ($this->hasTransaction()) {
                            $this->_toolbox->getTransactionManager()->addReadCollection($this->_toolbox->getVertexCollectionName());
                            $this->addTransactionCommand("function () {var temp = graph.getVertex('$id'); return temp ? temp._properties : null}();", "PodManager:load", null, true, array('type' => $type));
                        } else {
                            $vertex = $driver->getVertex($this->_toolbox->getGraph(), $id);

                            return $this->convertDriverDocumentToPod($vertex);
                        }
                        break;

                    case "edge":

                        if ($this->hasTransaction()) {
                            $this->_toolbox->getTransactionManager()->addReadCollection($this->_toolbox->getEdgeCollectionName());
                            $this->addTransactionCommand("graph.getEdge('$id')._properties;", "PodManager:load", null, true, array('type' => $type));
                        } else {
                            $edge = $driver->getEdge($this->_toolbox->getGraph(), $id);

                            return $this->convertDriverDocumentToPod($edge);
                        }
                        break;

                    default:
                        throw new PodManagerException("For graphs, only the types 'vertex' and 'edge' can be loaded.");
                }

            } else {

                if ($this->hasTransaction()) {
                    $this->_toolbox->getTransactionManager()->addReadCollection($type);
                    $this->addTransactionCommand("db.$type.document('$id');", "PodManager:load", null, false, array('type' => $type));
                } else {
                    $document = $driver->getById($type, $id);

                    return $this->convertDriverDocumentToPod($document);
                }

            }
        } catch (\Exception $e) {

            //Rethrow the exception from the try block
            if ($e instanceof PodManagerException) {
                throw $e;

            //Otherwise just return a null if the pod does not exist, or if there is an error.
            } else {
                return null;
            }
        }

    }
public function load ( $ type , $ id ) { $ driver = $ this -> _toolbox -> getDriver ( ) ; try { if ( $ this -> _toolbox -> isGraph ( ) ) { switch ( strtolower ( $ type ) ) { case "vertex" : if ( $ this -> hasTransaction ( ) ) { $ this -> _toolbox -> getTransactionManager ( ) -> addReadCollection ( $ this -> _toolbox -> getVertexCollectionName ( ) ) ; $ this -> addTransactionCommand ( "function () {var temp = graph.getVertex('$id'); return temp ? temp._properties : null}();" , "PodManager:load" , null , true , array ( 'type' => $ type ) ) ; } else { $ vertex = $ driver -> getVertex ( $ this -> _toolbox -> getGraph ( ) , $ id ) ; return $ this -> convertDriverDocumentToPod ( $ vertex ) ; } break ; case "edge" : if ( $ this -> hasTransaction ( ) ) { $ this -> _toolbox -> getTransactionManager ( ) -> addReadCollection ( $ this -> _toolbox -> getEdgeCollectionName ( ) ) ; $ this -> addTransactionCommand ( "graph.getEdge('$id')._properties;" , "PodManager:load" , null , true , array ( 'type' => $ type ) ) ; } else { $ edge = $ driver -> getEdge ( $ this -> _toolbox -> getGraph ( ) , $ id ) ; return $ this -> convertDriverDocumentToPod ( $ edge ) ; } break ; default : throw new PodManagerException ( "For graphs, only the types 'vertex' and 'edge' can be loaded." ) ; } } else { if ( $ this -> hasTransaction ( ) ) { $ this -> _toolbox -> getTransactionManager ( ) -> addReadCollection ( $ type ) ; $ this -> addTransactionCommand ( "db.$type.document('$id');" , "PodManager:load" , null , false , array ( 'type' => $ type ) ) ; } else { $ document = $ driver -> getById ( $ type , $ id ) ; return $ this -> convertDriverDocumentToPod ( $ document ) ; } } } catch ( \ Exception $ e ) { //Rethrow the exception from the try block if ( $ e instanceof PodManagerException ) { throw $ e ; //Otherwise just return a null if the pod does not exist, or if there is an error. } else { return null ; } } }
Loads a model from the server using the collection type and the id. Returns null if the pod could not be found or loaded.
@param  string $collection The collection to load from. For graphs, this can only be "vertex" or "edge".
@param  string $id         The id (key in ArangoDB jargon) of the document, edge or vertex.
@return AModel
Loads a model from the server using the collection type and the id . Returns null if the pod could not be found or loaded .