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

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

            if ($edgeCollectionsCount === 1) {
                $collection = $edgeCollections[0];
            }
        }

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

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

        $options['_isNew'] = false;

        $_edgeClass = $this->_edgeClass;
        return $_edgeClass::createFromArray($edge, $options);
    }
public function getEdge($graph, $edgeId, array $options = [], $collection = null)
    {
        if ($graph instanceof Graph) {
            $graph = $graph->getKey();
        }
        $parts = explode('/', $edgeId);
        if (count($parts) === 2) {
            list($collection, $edgeId) = $parts;
        }

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

            if ($edgeCollectionsCount === 1) {
                $collection = $edgeCollections[0];
            }
        }

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

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

        $options['_isNew'] = false;

        $_edgeClass = $this->_edgeClass;
        return $_edgeClass::createFromArray($edge, $options);
    }
public function getEdge ( $ graph , $ edgeId , array $ options = [ ] , $ collection = null ) { if ( $ graph instanceof Graph ) { $ graph = $ graph -> getKey ( ) ; } $ parts = explode ( '/' , $ edgeId ) ; if ( count ( $ parts ) === 2 ) { list ( $ collection , $ edgeId ) = $ parts ; } if ( $ collection === null ) { $ edgeCollections = $ this -> getEdgeCollections ( $ graph ) ; $ edgeCollectionsCount = count ( $ edgeCollections ) ; if ( $ edgeCollectionsCount !== 1 ) { throw new ClientException ( 'A collection must be provided.' ) ; } if ( $ edgeCollectionsCount === 1 ) { $ collection = $ edgeCollections [ 0 ] ; } } $ url = UrlHelper :: buildUrl ( Urls :: URL_GRAPH , [ $ graph , Urls :: URLPART_EDGE , $ collection , $ edgeId ] ) ; $ response = $ this -> getConnection ( ) -> get ( $ url ) ; $ jsonArray = $ response -> getJson ( ) ; $ edge = $ jsonArray [ 'edge' ] ; $ options [ '_isNew' ] = false ; $ _edgeClass = $ this -> _edgeClass ; return $ _edgeClass :: createFromArray ( $ edge , $ options ) ; }
Get a single edge from a graph

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

@throws Exception

@param mixed  $graph      - graph name as a string or instance of Graph
@param mixed  $edgeId     - edge identifier
@param array  $options    optional, 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

@return Document - the edge document fetched from the server
@since 1.2
Get a single edge from a graph