/** * _associate_attendee_with_registration * * @param EE_Registration $registration * @param EE_Attendee $attendee * @return void */ private function _associate_attendee_with_registration(EE_Registration $registration, EE_Attendee $attendee) { // add relation to attendee $registration->_add_relation_to($attendee, 'Attendee'); $registration->set_attendee_id($attendee->ID()); $registration->update_cache_after_object_save('Attendee', $attendee); }
/** * _save_question_answers * * @param EE_Registration $registration * @param bool $show_errors * @return void */ private function _save_registration_answers($registration, $show_errors = TRUE) { // now save the answers foreach ($registration->answers() as $cache_key => $answer) { // verify object if ($answer instanceof EE_Answer) { $answer->set_registration($registration->ID()); $answer->save(); if (!$registration->update_cache_after_object_save('Answer', $answer, $cache_key)) { if ($show_errors) { EE_Error::add_error(__('The newly saved Answer object could not be cached on the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); } } } else { if ($show_errors) { EE_Error::add_error(__('An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); } } } }