readFromDb('kompass_veranstaltungen_index', ['id' => $event_id]); $class = new Event(); $class->groups = ['participant' => [], 'volunteer' => [], 'other' => []]; foreach (get_object_vars($data[0]) as $key => $value) { $class->$key = $value; } foreach (EventParticipant::list_for_event($event_id) as $participant) { $class->groups[$participant->teilnahme][] = $participant; } foreach ($class->groups as $group) { foreach ($group as $participant) { if (!isset($class->tribes[$participant->stamm])) { $class->tribes[$participant->stamm] = []; } $class->tribes[$participant->stamm][] = $participant; } } #echo '
';print_r($class);die(); return $class; } public function __construct() { $this->_tablename = 'kompass_veranstaltungen_index'; $this->groups = []; $this->tribes = []; } }