public function init()
    {
        // If the step is not a registered step exit
        if (!in_array($this->step, CheckoutSteps::getSteps())) {
            $this->redirect($this->Link('/'));
        }

        // If no ReservationSession exists redirect back to the base event controller
        elseif (empty(ReservationSession::get())) {
            $this->redirect($this->Link('/'));
        }

        // If the reservation has been processed end the session and redirect
        elseif (ReservationSession::get()->Status === 'PAID' && $this->step != 'success') {
            ReservationSession::end();
            $this->redirect($this->Link('/'));
        } else {
            $this->reservation = ReservationSession::get();
            parent::init();
        }
    }
public function init()
    {
        // If the step is not a registered step exit
        if (!in_array($this->step, CheckoutSteps::getSteps())) {
            $this->redirect($this->Link('/'));
        }

        // If no ReservationSession exists redirect back to the base event controller
        elseif (empty(ReservationSession::get())) {
            $this->redirect($this->Link('/'));
        }

        // If the reservation has been processed end the session and redirect
        elseif (ReservationSession::get()->Status === 'PAID' && $this->step != 'success') {
            ReservationSession::end();
            $this->redirect($this->Link('/'));
        } else {
            $this->reservation = ReservationSession::get();
            parent::init();
        }
    }
public function init ( ) { // If the step is not a registered step exit if ( ! in_array ( $ this -> step , CheckoutSteps :: getSteps ( ) ) ) { $ this -> redirect ( $ this -> Link ( '/' ) ) ; } // If no ReservationSession exists redirect back to the base event controller elseif ( empty ( ReservationSession :: get ( ) ) ) { $ this -> redirect ( $ this -> Link ( '/' ) ) ; } // If the reservation has been processed end the session and redirect elseif ( ReservationSession :: get ( ) -> Status === 'PAID' && $ this -> step != 'success' ) { ReservationSession :: end ( ) ; $ this -> redirect ( $ this -> Link ( '/' ) ) ; } else { $ this -> reservation = ReservationSession :: get ( ) ; parent :: init ( ) ; } }
Init the controller and check if the current step is allowed
Init the controller and check if the current step is allowed