Esempio n. 1
0
 /**
  * Get all of the finds for a person
  *
  * @param Person  $person The Person object
  * @param integer $limit
  * @param integer $offset
  *
  * @return array
  */
 public function getForPerson($person, $limit = 20, $offset = 0)
 {
     // Get all of the related finds
     $personNode = $person->getNode();
     $relationships = $personNode->getRelationships(['P29'], Relationship::DirectionOut);
     // Apply paging by taking a slice of the relationships array
     $relationships = array_slice($relationships, $offset, $limit);
     $finds = [];
     foreach ($relationships as $relation) {
         $find_node = $relation->getEndNode();
         $findEvent = new FindEvent();
         $findEvent->setNode($find_node);
         // Get the entire data that's behind the find
         $find = $findEvent->getValues();
         $finds[] = $find;
     }
     return ['data' => $finds, 'count' => count($relationships)];
 }