public function ambilSemuaSiswaDenganKelas() { $ps = $this->connection->prepare("SELECT siswa.nomor_siswa,siswa.nama as namaSiswa,kelas.id_kelas,kelas.nama as namaKelas\n\t\t\tFROM siswa INNER JOIN kelas on(siswa.id_kelas=kelas.id_kelas)\n ORDER BY namaKelas,namaSiswa"); $ps->execute(); $rs = $ps->fetchAll(); $siswas = new ArrayObject(); foreach ($rs as $s) { $siswa = new Siswa(); $kelas = new Kelas(); $siswa->setNomorSiswa($s["nomor_siswa"]); $siswa->setNama($s['namaSiswa']); $kelas->setIdKelas($s["id_kelas"]); $kelas->setNama($s["namaKelas"]); $siswa->setKelas($kelas); $siswas->append($siswa); } return $siswas; }