Esempio n. 1
0
 public function getByClientNode(Neo4j\Node $client_node)
 {
     foreach ($client_node->getLabels() as $label) {
         if ($this->hasNode($label->getName())) {
             return $this->getNode($label->getName());
         }
     }
 }
 public static function label_names(Everyman\Neo4j\Node $node)
 {
     $label_names = array();
     foreach ($node->getLabels() as $label) {
         array_push($label_names, $label->getName());
     }
     return $label_names;
 }
Esempio n. 3
0
 public function envelopes(Neo4j\Node $client_node)
 {
     $schema_name = $this->getName();
     // Check that the client node matches the schema.
     foreach ($client_node->getLabels() as $label) {
         if ($label->getName() === $schema_name) {
             return true;
         }
     }
     return false;
 }
Esempio n. 4
0
 /**
  * Hydrate a Collection from an Neo4J Node
  *
  * @param \Everyman\Neo4j\Node $row a single row from result set to map.
  * @return Collection
  */
 protected function nodeToCollection(\EveryMan\Neo4j\Node $row)
 {
     // Or we map a single record to a Spider Record
     $collection = new Collection();
     foreach ($row->getProperties() as $key => $value) {
         $collection->add($key, $value);
     }
     //handle labels
     $labels = $row->getLabels();
     if (!empty($labels)) {
         $collection->add(['meta.label' => $labels[0]->getName(), 'label' => $labels[0]->getName()]);
     }
     $collection->add(['meta.id' => $row->getId(), 'id' => $row->getId()]);
     $collection->protect('meta');
     $collection->protect('id');
     $collection->protect('label');
     return $collection;
 }