public function getAllAsObject($restriction = '') { $sql = "SELECT *\n\t\t\t\tFROM anwesenheit\n\t\t\t\tWHERE 1=1"; $sql .= $restriction . ";"; try { $result = mysql_query($sql); if (!$result) { throw new MysqlException(); } $anwesenheiten = array(); while ($row = mysql_fetch_assoc($result)) { $a = new Anwesenheit(); $a->setId($row['anwesenheit_id']); $a->setSchueler_id($row['schueler_id']); $a->setUnterrichtsstunde_id($row['unterrichtsstunde_id']); $a->setVerspaetung($row['verspaetung']); $a->setStatus($row['status']); $anwesenheiten[$a->getId()] = $a; } } catch (MysqlException $e) { Html::showAll($e); } return $anwesenheiten; }