/** * Modify a session by deleting it, creating a new session, and transferring over tutors and attenders. */ public function modifySession($sessionID, $date, $time, $subject, $gradeLevel) { $oldSession = new Session($sessionID); $attenders = $oldSession->getSessionAttenders(); $tutors = $oldSession->getSessionTutors(); $this->cancelSession($sessionID); $newID = $this->createSession($date, $time, $subject, $gradeLevel); /* Add attenders to new session: */ while ($row = $attenders->fetch_assoc()) { $attender = new Attender($row['userID'], $this->connection); $attender->willAttend($newID); } /* Add tutors to new session: */ while ($row = $tutors->fetch_assoc()) { $tutor = new Tutor($row['tutorID'], $this->connection); $tutor->signUpToTutor($newID); } }