src/MainBundle/Controller/AppointmentController.php
/**
	* Change status to 'Cancelled' when patient declined the invitation.
	* No action when patient accepted the invitation.
	*
	*/
Change status to 'Cancelled' when patient declined the invitation.
No action when patient accepted the invitation.
Change status to ' Cancelled ' when patient declined the invitation . No action when patient accepted the invitation .
public function statusChangeAction($action,$id)
	{
		if($id == '' && $action == '') {
			return $this->redirect($this->generateUrl('homepage'));
		}
		$doctrine  = $this->getDoctrine()->getManager();
		$schedule  = $doctrine->getRepository('MainBundle:Schedule')->find($id);
		if($schedule->getScheduleStatus()->getId() == 1 
			|| $schedule->getScheduleStatus()->getId() == 2) {
				if($action == 'decline'){
					$schedulestatus = $doctrine->getRepository('MainBundle:ScheduleStatus')->find(3);
					$schedule->setScheduleStatus($schedulestatus);
					$doctrine->persist($schedule);
					$doctrine->flush();
				}
				return $this->redirect($this->generateUrl('appointment'));		
		} else {
			return $this->redirect($this->generateUrl('homepage'));
		}
	}
public function statusChangeAction ( $ action , $ id ) { if ( $ id == '' && $ action == '' ) { return $ this -> redirect ( $ this -> generateUrl ( 'homepage' ) ) ; } $ doctrine = $ this -> getDoctrine ( ) -> getManager ( ) ; $ schedule = $ doctrine -> getRepository ( 'MainBundle:Schedule' ) -> find ( $ id ) ; if ( $ schedule -> getScheduleStatus ( ) -> getId ( ) == 1 || $ schedule -> getScheduleStatus ( ) -> getId ( ) == 2 ) { if ( $ action == 'decline' ) { $ schedulestatus = $ doctrine -> getRepository ( 'MainBundle:ScheduleStatus' ) -> find ( 3 ) ; $ schedule -> setScheduleStatus ( $ schedulestatus ) ; $ doctrine -> persist ( $ schedule ) ; $ doctrine -> flush ( ) ; } return $ this -> redirect ( $ this -> generateUrl ( 'appointment' ) ) ; } else { return $ this -> redirect ( $ this -> generateUrl ( 'homepage' ) ) ; } }
Change status to 'Cancelled' when patient declined the invitation.
Change status to ' Cancelled ' when patient declined the invitation .
// change status to 'Cancelled'