code/controllers/EventAttendeeController.php
public function save($data, $form) {
		//look for attendee id in form field or request params
		$attendeeid = $form->Fields()->fieldByName("ID")->dataValue();
		//look for existing attendee
		$attendee = $this->registration->Attendees()
			->byID((int)$attendeeid);
		//prevent changes to the type of ticket
		if($attendee && $attendee->TicketID && $attendee->TicketID != $data['TicketID']){
			$form->sessionMessage('You cannot change the ticket', 'bad');
			return $this->redirectBack();
		}
		//create new attendee
		if(!$attendee){
			$attendee = $this->createAttendee();
		}
		//save ticket selection
		$form->saveInto($attendee);
		$attendee->write();

		$this->registration->calculateTotal();
		$this->registration->write();

		$this->extend("onSave", $attendee, $this->registration);
		
		return $this->redirect($this->NextURL);
	}
public function save($data, $form) {
		//look for attendee id in form field or request params
		$attendeeid = $form->Fields()->fieldByName("ID")->dataValue();
		//look for existing attendee
		$attendee = $this->registration->Attendees()
			->byID((int)$attendeeid);
		//prevent changes to the type of ticket
		if($attendee && $attendee->TicketID && $attendee->TicketID != $data['TicketID']){
			$form->sessionMessage('You cannot change the ticket', 'bad');
			return $this->redirectBack();
		}
		//create new attendee
		if(!$attendee){
			$attendee = $this->createAttendee();
		}
		//save ticket selection
		$form->saveInto($attendee);
		$attendee->write();

		$this->registration->calculateTotal();
		$this->registration->write();

		$this->extend("onSave", $attendee, $this->registration);
		
		return $this->redirect($this->NextURL);
	}
public function save ( $ data , $ form ) { //look for attendee id in form field or request params $ attendeeid = $ form -> Fields ( ) -> fieldByName ( "ID" ) -> dataValue ( ) ; //look for existing attendee $ attendee = $ this -> registration -> Attendees ( ) -> byID ( ( int ) $ attendeeid ) ; //prevent changes to the type of ticket if ( $ attendee && $ attendee -> TicketID && $ attendee -> TicketID != $ data [ 'TicketID' ] ) { $ form -> sessionMessage ( 'You cannot change the ticket' , 'bad' ) ; return $ this -> redirectBack ( ) ; } //create new attendee if ( ! $ attendee ) { $ attendee = $ this -> createAttendee ( ) ; } //save ticket selection $ form -> saveInto ( $ attendee ) ; $ attendee -> write ( ) ; $ this -> registration -> calculateTotal ( ) ; $ this -> registration -> write ( ) ; $ this -> extend ( "onSave" , $ attendee , $ this -> registration ) ; return $ this -> redirect ( $ this -> NextURL ) ; }
Save new and edited attendees
@param  array $data
@param  Form $form
@return HTTPResponse
Save new and edited attendees