/** * 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 */ public function createGraph(Graph $graph) { $edgeDefintions = array(); foreach ($graph->getEdgeDefinitions() as $ed) { $edgeDefintions[] = $ed->transformToArray(); } $params = array(self::OPTION_NAME => $graph->getKey(), self::OPTION_EDGE_DEFINITIONS => $edgeDefintions, 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(); }