示例#1
0
 /**
  *
  * @param $exception Exception
  *
  * @throws Exception
  * @return void
  */
 public function handleException($exception)
 {
     $this->request = new Enlight_Controller_Request_RequestHttp();
     $this->response = new Enlight_Controller_Response_ResponseHttp();
     if ($this->isModelException($exception)) {
         $path = Shopware()->Models()->getConfiguration()->getAttributeDir();
         $result = $this->generateModels($path);
         if ($result['success'] === true) {
             $this->response->setRedirect($this->request->getRequestUri());
             setcookie(self::redirectCookieString, true, time() + 5);
             $this->response->sendResponse();
             exit;
         } else {
             die(sprintf("Failed to create the attribute models, please check the permissions of the '%s' directory", $path));
         }
     }
 }
 /**
  *
  * @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()));
         }
     }
 }