public function getVertex($graph, $vertexId, array $options = [], $collection = null)
    {
        if ($graph instanceof Graph) {
            $graph = $graph->getKey();
        }
        $parts = explode('/', $vertexId);
        if (count($parts) === 2) {
            list($collection, $vertexId) = $parts;
        }

        if ($collection === null) {
            $vertexCollections      = $this->getVertexCollections($graph);
            $vertexCollectionsCount = count($vertexCollections);
            if ($vertexCollectionsCount !== 1) {
                throw new ClientException('A collection must be provided.');
            }

            if ($vertexCollectionsCount === 1) {
                $collection = $vertexCollections[0];
            }
        }

        $url      = UrlHelper::buildUrl(Urls::URL_GRAPH, [$graph, Urls::URLPART_VERTEX, $collection, $vertexId]);
        $response = $this->getConnection()->get($url);

        $jsonArray = $response->getJson();
        $vertex    = $jsonArray['vertex'];

        $options['_isNew'] = false;

        $_documentClass = $this->_documentClass;

        return $_documentClass::createFromArray($vertex, $options);
    }
public function getVertex($graph, $vertexId, array $options = [], $collection = null)
    {
        if ($graph instanceof Graph) {
            $graph = $graph->getKey();
        }
        $parts = explode('/', $vertexId);
        if (count($parts) === 2) {
            list($collection, $vertexId) = $parts;
        }

        if ($collection === null) {
            $vertexCollections      = $this->getVertexCollections($graph);
            $vertexCollectionsCount = count($vertexCollections);
            if ($vertexCollectionsCount !== 1) {
                throw new ClientException('A collection must be provided.');
            }

            if ($vertexCollectionsCount === 1) {
                $collection = $vertexCollections[0];
            }
        }

        $url      = UrlHelper::buildUrl(Urls::URL_GRAPH, [$graph, Urls::URLPART_VERTEX, $collection, $vertexId]);
        $response = $this->getConnection()->get($url);

        $jsonArray = $response->getJson();
        $vertex    = $jsonArray['vertex'];

        $options['_isNew'] = false;

        $_documentClass = $this->_documentClass;

        return $_documentClass::createFromArray($vertex, $options);
    }
public function getVertex ( $ graph , $ vertexId , array $ options = [ ] , $ collection = null ) { if ( $ graph instanceof Graph ) { $ graph = $ graph -> getKey ( ) ; } $ parts = explode ( '/' , $ vertexId ) ; if ( count ( $ parts ) === 2 ) { list ( $ collection , $ vertexId ) = $ parts ; } if ( $ collection === null ) { $ vertexCollections = $ this -> getVertexCollections ( $ graph ) ; $ vertexCollectionsCount = count ( $ vertexCollections ) ; if ( $ vertexCollectionsCount !== 1 ) { throw new ClientException ( 'A collection must be provided.' ) ; } if ( $ vertexCollectionsCount === 1 ) { $ collection = $ vertexCollections [ 0 ] ; } } $ url = UrlHelper :: buildUrl ( Urls :: URL_GRAPH , [ $ graph , Urls :: URLPART_VERTEX , $ collection , $ vertexId ] ) ; $ response = $ this -> getConnection ( ) -> get ( $ url ) ; $ jsonArray = $ response -> getJson ( ) ; $ vertex = $ jsonArray [ 'vertex' ] ; $ options [ '_isNew' ] = false ; $ _documentClass = $ this -> _documentClass ; return $ _documentClass :: createFromArray ( $ vertex , $ options ) ; }
Get a single vertex from a graph

This will throw if the vertex cannot be fetched from the server<br><br>

@throws Exception

@param mixed  $graph      - graph name as a string or instance of Graph
@param mixed  $vertexId   - the vertex identifier
@param array  $options    optional, an array of options:
<p>
<li><b>_includeInternals</b> - true to include the internal attributes. Defaults to false</li>
<li><b>_ignoreHiddenAttributes</b> - true to show hidden attributes. Defaults to false</li>
</p>
@param string $collection - if one uses a graph with more than one vertex collection one must provide the collection
to load the vertex.

@return Document
@since 1.2
Get a single vertex from a graph