Beispiel #1
0
 public static function inflateFromResponse($db, $response)
 {
     $start_path = explode("/", $response['start']);
     $end_path = explode("/", $response['end']);
     $self_path = explode("/", $response['self']);
     $start = $db->getNodeById(end($start_path));
     $end = $db->getNodeById(end($end_path));
     $relationship = new Relationship($db, $start, $end, $response['type']);
     $relationship->_is_new = false;
     $relationship->_id = end($self_path);
     $relationship->setProperties($response['data']);
     return $relationship;
 }
Beispiel #2
0
 /**
  * Fill a relationship with data
  *
  * @param Relationship $rel
  * @param array $data
  * @return Relationship
  */
 public function populateRelationship(Relationship $rel, $data)
 {
     $rel->useLazyLoad(false);
     $rel->setProperties($data['data']);
     $rel->setType($data['type']);
     $rel->setStartNode($this->getNodeFromUri($data['start']));
     $rel->setEndNode($this->getNodeFromUri($data['end']));
     return $rel;
 }
Beispiel #3
0
 /**
  * Load the given relationship with data from the server
  *
  * @param Relationship $rel
  * @return boolean
  */
 public function loadRelationship(Relationship $rel)
 {
     $cached = $this->getEntityCache()->getCachedEntity($rel->getId(), 'relationship');
     if ($cached) {
         $rel->setProperties($cached->getProperties());
         return true;
     }
     return $this->runCommand(new Command\GetRelationship($this, $rel));
 }
 public static function inflateFromResponse(GraphDatabaseService $neo_db, array $response)
 {
     $start_id = end(explode("/", $response['start']));
     $end_id = end(explode("/", $response['end']));
     $start = $neo_db->getNodeById($start_id);
     $end = $neo_db->getNodeById($end_id);
     $relationship = new Relationship($neo_db, $start, $end, $response['type']);
     $relationship->_is_new = FALSE;
     $relationship->_id = end(explode("/", $response['self']));
     $relationship->setProperties($response['data']);
     return $relationship;
 }