public function createGraph(Graph $graph)
    {
        $edgeDefinitions = [];
        foreach ($graph->getEdgeDefinitions() as $ed) {
            $edgeDefinitions[] = $ed->transformToArray();
        }

        $params   = [
            self::OPTION_NAME               => $graph->getKey(),
            self::OPTION_EDGE_DEFINITIONS   => $edgeDefinitions,
            self::OPTION_ORPHAN_COLLECTIONS => $graph->getOrphanCollections()
        ];
        $url      = Urls::URL_GRAPH;
        $response = $this->getConnection()->post($url, $this->json_encode_wrapper($params));
        $json     = $response->getJson();
        $graph->setInternalId($json['graph'][Graph::ENTRY_ID]);
        $graph->set(Graph::ENTRY_KEY, $json['graph'][self::OPTION_NAME]);
        $graph->setRevision($json['graph'][Graph::ENTRY_REV]);

        return $graph->getAll();
    }
public function createGraph(Graph $graph)
    {
        $edgeDefinitions = [];
        foreach ($graph->getEdgeDefinitions() as $ed) {
            $edgeDefinitions[] = $ed->transformToArray();
        }

        $params   = [
            self::OPTION_NAME               => $graph->getKey(),
            self::OPTION_EDGE_DEFINITIONS   => $edgeDefinitions,
            self::OPTION_ORPHAN_COLLECTIONS => $graph->getOrphanCollections()
        ];
        $url      = Urls::URL_GRAPH;
        $response = $this->getConnection()->post($url, $this->json_encode_wrapper($params));
        $json     = $response->getJson();
        $graph->setInternalId($json['graph'][Graph::ENTRY_ID]);
        $graph->set(Graph::ENTRY_KEY, $json['graph'][self::OPTION_NAME]);
        $graph->setRevision($json['graph'][Graph::ENTRY_REV]);

        return $graph->getAll();
    }
public function createGraph ( Graph $ graph ) { $ edgeDefinitions = [ ] ; foreach ( $ graph -> getEdgeDefinitions ( ) as $ ed ) { $ edgeDefinitions [ ] = $ ed -> transformToArray ( ) ; } $ params = [ self :: OPTION_NAME => $ graph -> getKey ( ) , self :: OPTION_EDGE_DEFINITIONS => $ edgeDefinitions , self :: OPTION_ORPHAN_COLLECTIONS => $ graph -> getOrphanCollections ( ) ] ; $ url = Urls :: URL_GRAPH ; $ response = $ this -> getConnection ( ) -> post ( $ url , $ this -> json_encode_wrapper ( $ params ) ) ; $ json = $ response -> getJson ( ) ; $ graph -> setInternalId ( $ json [ 'graph' ] [ Graph :: ENTRY_ID ] ) ; $ graph -> set ( Graph :: ENTRY_KEY , $ json [ 'graph' ] [ self :: OPTION_NAME ] ) ; $ graph -> setRevision ( $ json [ 'graph' ] [ Graph :: ENTRY_REV ] ) ; return $ graph -> getAll ( ) ; }
Create a graph

This will create a graph using the given graph object and return an array of the created graph object's attributes.<br><br>

@throws Exception

@param Graph $graph - The graph object which holds the information of the graph to be created

@return array
@since   1.2
Create a graph