private function validateSignUpStatus($session, $currentRoute) { $response = null; $signupStepStatus = $session->get('institutionSignupStepStatus'); // check if the institution has completed sign up flow if ($session->get('isSingleCenterInstitution')) { $lastStep = $this->institutionSignUpService->getSingleCenterSignUpLastStep(); $nextStep = $this->institutionSignUpService->getSingleCenterSignUpNextStep($signupStepStatus); } else { $lastStep = $this->institutionSignUpService->getMultipleCenterSignUpLastStep(); $nextStep = $this->institutionSignUpService->getMultipleCenterSignUpNextStep($signupStepStatus); } // has not completed institution sign up flow yet if ($lastStep && $signupStepStatus < $lastStep->getStepNumber()) { $routeName = $nextStep->getRoute(); // we don't need to redirect anymore if ($routeName != $currentRoute) { $routeParams = array(); // only steps other than step 1 has imcId parameter if ($signupStepStatus > 1) { $medicalCenter = $this->institutionService->getFirstMedicalCenterByInstitutionId($session->get('institutionId')); $routeParams = array('imcId' => $medicalCenter ? $medicalCenter->getId() : 0); } // redirect to incomplete step in signup flow $response = new RedirectResponse($this->router->generate($routeName, $routeParams)); } } return $response; }