Esempio n. 1
0
 public function getDirectionalVertices($direction)
 {
     $direction = rtrim(strtolower($direction), 'e');
     $directions = array('in', 'out', 'both');
     if (!in_array($direction, $directions)) {
         throw new \InvalidArgumentException("Invalid direction {$direction}");
     }
     if (empty($this->id)) {
         throw new \InvalidArgumentException("Invalid vertex id");
     }
     $url = $this->getPath() . '/' . $this->getId() . "/{$direction}";
     $response = $this->graph->makeRequest('GET', $url);
     return Factory::getObject($this->getClient(), $response);
 }
Esempio n. 2
0
 public function getEdge($edge_id)
 {
     if (empty($edge_id)) {
         throw new \InvalidArgumentException("Invalid edge id");
     }
     $response = $this->makeRequest('GET', "/edges/{$edge_id}");
     return Factory::getObject($this, $response);
 }
Esempio n. 3
0
 public function setFriend($name)
 {
     $this->friend = Factory::getObject($name);
 }
Esempio n. 4
0
 /**
  * Update an item in the graph
  * 
  * @param string $method - PUT OR POST
  * @throws Rexster_Exception
  * @return requested object type
  */
 public function update($method = 'POST')
 {
     if (empty($this->id)) {
         throw new \InvalidArgumentException('Invalid object id to update');
     }
     if ($this->id != $this->_id) {
         throw new \InvalidArgumentException("Node ID's do not match? this->_id = {$this->_id} -- this->id = {$this->id}");
     }
     $data = $this->toArray();
     if (empty($data)) {
         throw new \InvalidArgumentException("Invalid properies to update - Properties array should be an associative array of property => value");
     }
     $reserved = array('id', '_id');
     foreach ($reserved as $key) {
         if (isset($data[$key])) {
             unset($data[$key]);
         }
     }
     $url = '/' . $this->getPath() . '/' . $this->getId();
     $response = $this->getClient()->makeRequest($method, $url, $data);
     return Factory::getObject($this->getClient(), $response);
 }