/** * @param itemId is the id of a citizen * @param limit is the number of events we want to get * @return an array with the next event since the current day */ public static function getListCurrentEventsByPeopleId($userId, $limit = 20) { $listEvent = array(); $where = array('$and' => array(array("links.attendees." . $userId => array('$exists' => true)), array("endDate" => array('$gte' => new MongoDate(time()))))); $eventPeople = PHDB::findAndSort(self::COLLECTION, $where, array('endDate' => 1), $limit); return Event::addInfoEvents($eventPeople); }