function processNextStationByAppointmentAction() { $appointmentId = (int) $this->_getParam('appointmentId'); $stationId = $this->_getParam('stationId'); $appointment = new Appointment(); $appointment->appointmentId = $appointmentId; $appointment->populate(); $provider = new Provider(); $provider->personId = $appointment->providerId; $provider->populate(); $routing = new Routing(); $routing->personId = $appointment->patientId; $routing->appointmentId = $appointment->appointmentId; $routing->providerId = $appointment->providerId; $routing->roomId = $appointment->roomId; $routing->populateByAppointments(); $routing->fromStationId = $routing->stationId; $routing->stationId = $stationId; $routing->timestamp = date('Y-m-d H:i:s'); $routing->persist(); $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json'); $json->suppressExit = true; $json->direct(array(true)); }