Ejemplo n.º 1
0
 /**
  *
  * @param $exception \Exception
  *
  * @throws \Exception
  * @return void
  */
 private function handleException($exception)
 {
     $request = new \Enlight_Controller_Request_RequestHttp();
     $response = new \Enlight_Controller_Response_ResponseHttp();
     if ($this->isModelException($exception)) {
         $generator = $this->container->get('models')->createModelGenerator();
         $result = $generator->generateAttributeModels();
         if ($result['success'] === true) {
             $response->setRedirect($request->getRequestUri());
             setcookie(self::redirectCookieString, true, time() + 5);
             $response->sendResponse();
             exit;
         } else {
             die(sprintf("Failed to create the attribute models, please check the permissions of the '%s' directory", $generator->getPath()));
         }
     }
 }