/** * This handles connecting a attendee to related items when the chained flag is true. * * @since 4.3.0 * * @param EE_Attendee $attendee * @param array $args incoming arguments from caller for specifying overrides. * * @return EE_Attendee */ private function _maybe_chained(EE_Attendee $attendee, $args) { if ($this->_chained) { if (empty($this->_status)) { $this->_set_repeated_relation($args, $attendee->ID()); } //YES we DO want to set brand new relation objects because multiple attendees do not share the same related objects (for the purpose of tests at least) $this->_set_new_relations($args, $attendee->ID()); //note relation to registration should already be set via the factory->registration_chained->create() method. //add relation to status $attendee->_add_relation_to($this->_status, 'Status'); $attendee->save(); return $attendee; } return $attendee; }
/** * _update_existing_attendee_data - in case it has changed since last time they registered for an event * * @param EE_Attendee $existing_attendee * @param array $attendee_data * @return \EE_Attendee */ private function _update_existing_attendee_data(EE_Attendee $existing_attendee, $attendee_data = array()) { // first remove fname, lname, and email from attendee data $dont_set = array('ATT_fname', 'ATT_lname', 'ATT_email'); // now loop thru what's left and add to attendee CPT foreach ($attendee_data as $property_name => $property_value) { if (!in_array($property_name, $dont_set) && EEM_Attendee::instance()->has_field($property_name)) { $existing_attendee->set($property_name, $property_value); } } // better save that now $existing_attendee->save(); return $existing_attendee; }