Exemple #1
0
 /**
  * @return string
  */
 public function getUri()
 {
     if ($this->_is_new) {
         $uri = $this->getStartNode()->getUri() . '/relationships';
     } else {
         $uri = $this->_db->getBaseUri() . 'relationship/' . $this->getId();
     }
     #if (!$this->_is_new) $uri .= '/'.$this->getId();
     return $uri;
 }
Exemple #2
0
 /**
  * get nodex by key value pair
  *
  * @throws \Neo4j\Exception\HttpException
  * @throws \Neo4j\Exception\NotFoundException
  *
  * @param string $key
  * @param string $value
  *
  * @return array
  */
 public function getNodes($key, $value)
 {
     $nodes = array();
     $this->_uri = $this->_db->getBaseUri() . 'index/node/' . $key . '/' . $value;
     list($response, $http_code) = Request::get($this->_uri);
     if ($http_code != 200) {
         throw new \Neo4j\Exception\HttpException("http code: " . $http_code . ", response: " . print_r($response, true));
     }
     foreach ($response as $nodeData) {
         $nodes[] = Node::inflateFromResponse($this->_db, $nodeData);
     }
     if (empty($nodes)) {
         throw new \Neo4j\Exception\NotFoundException();
     }
     return $nodes;
 }