public function addEdgeDefinition($graph, $edgeDefinition)
    {
        if ($graph instanceof Graph) {
            $graph = $graph->getKey();
        }

        $url  = UrlHelper::buildUrl(Urls::URL_GRAPH, [$graph, Urls::URLPART_EDGE]);
        $data = $edgeDefinition->transformToArray();

        try {
            $response = $this->getConnection()->post($url, $this->json_encode_wrapper($data));

        } catch (Exception $e) {
            throw new ClientException($e->getMessage());
        }

        $data = $response->getJson();

        $options['_isNew'] = false;

        $result = Graph::createFromArray($data['graph'], $options);
        $result->set(Graph::ENTRY_KEY, $data['graph'][self::OPTION_NAME]);

        return $result;
    }
public function addEdgeDefinition($graph, $edgeDefinition)
    {
        if ($graph instanceof Graph) {
            $graph = $graph->getKey();
        }

        $url  = UrlHelper::buildUrl(Urls::URL_GRAPH, [$graph, Urls::URLPART_EDGE]);
        $data = $edgeDefinition->transformToArray();

        try {
            $response = $this->getConnection()->post($url, $this->json_encode_wrapper($data));

        } catch (Exception $e) {
            throw new ClientException($e->getMessage());
        }

        $data = $response->getJson();

        $options['_isNew'] = false;

        $result = Graph::createFromArray($data['graph'], $options);
        $result->set(Graph::ENTRY_KEY, $data['graph'][self::OPTION_NAME]);

        return $result;
    }
public function addEdgeDefinition ( $ graph , $ edgeDefinition ) { if ( $ graph instanceof Graph ) { $ graph = $ graph -> getKey ( ) ; } $ url = UrlHelper :: buildUrl ( Urls :: URL_GRAPH , [ $ graph , Urls :: URLPART_EDGE ] ) ; $ data = $ edgeDefinition -> transformToArray ( ) ; try { $ response = $ this -> getConnection ( ) -> post ( $ url , $ this -> json_encode_wrapper ( $ data ) ) ; } catch ( Exception $ e ) { throw new ClientException ( $ e -> getMessage ( ) ) ; } $ data = $ response -> getJson ( ) ; $ options [ '_isNew' ] = false ; $ result = Graph :: createFromArray ( $ data [ 'graph' ] , $ options ) ; $ result -> set ( Graph :: ENTRY_KEY , $ data [ 'graph' ] [ self :: OPTION_NAME ] ) ; return $ result ; }
adds an edge definition to the graph.

This will add a further edge definition to the graph.<br><br>


@throws Exception

@param mixed          $graph          - graph name as a string or instance of Graph
@param EdgeDefinition $edgeDefinition - the new edge definition.

@return Graph
@since 2.2
adds an edge definition to the graph .