function &createAppointment($user, $scheduleItem) { $dbcon = AMP_Registry::getDbcon(); $appointment = new Appointment($dbcon); $appointment->setParticipant($user); $appointment->setScheduleItem($scheduleItem); return $appointment; }