当前位置: 首页>>代码示例>>PHP>>正文


PHP AppKernel::isDebug方法代码示例

本文整理汇总了PHP中AppKernel::isDebug方法的典型用法代码示例。如果您正苦于以下问题:PHP AppKernel::isDebug方法的具体用法?PHP AppKernel::isDebug怎么用?PHP AppKernel::isDebug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AppKernel的用法示例。


在下文中一共展示了AppKernel::isDebug方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: onKernelRequest

 /**
  * @param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event
  */
 public function onKernelRequest(GetResponseEvent $event)
 {
     $request = $event->getRequest();
     $route = $request->attributes->get('_route');
     if (empty($route)) {
         $route = $request->attributes->get('_master_request_route');
     }
     if (!$this->provider->isItemWhitelisted($route)) {
         $notFoundException = new NotFoundHttpException('Sorry, the page that you requested was not found.');
         $statusCode = $notFoundException->getStatusCode();
         $parameters = ['status_code' => $statusCode, 'status_text' => Response::$statusTexts[$statusCode], 'currentContent' => '', 'exception' => FlattenException::create($notFoundException), 'logger' => $this->logger];
         $view = View::create($parameters);
         $view->setFormat(self::VIEW_FORMAT);
         $view->setTemplate($this->findTemplate($request, $statusCode, $this->kernel->isDebug()));
         $response = $this->viewHandler->handle($view);
         $event->setResponse($response);
     }
 }
开发者ID:gitter-badger,项目名称:diamantedesk-application,代码行数:21,代码来源:OroApiCallRestrictionListener.php

示例2: setServiceKernel

 /**
  * 每个testXXX执行之前,都会执行此函数,净化数据库。
  * 
  * NOTE: 如果数据库已创建,那么执行清表操作,不重建。
  */
 private function setServiceKernel()
 {
     $kernel = new \AppKernel('test', false);
     $kernel->loadClassCache();
     $kernel->boot();
     Request::enableHttpMethodParameterOverride();
     $request = Request::createFromGlobals();
     $serviceKernel = ServiceKernel::create($kernel->getEnvironment(), $kernel->isDebug());
     $serviceKernel->setParameterBag($kernel->getContainer()->getParameterBag());
     $serviceKernel->setConnection($kernel->getContainer()->get('database_connection'));
     $currentUser = new CurrentUser();
     $currentUser->fromArray(array('id' => 1, 'nickname' => 'admin', 'email' => 'admin@admin.com', 'password' => 'admin', 'currentIp' => '127.0.0.1', 'roles' => array('ROLE_USER', 'ROLE_ADMIN', 'ROLE_SUPER_ADMIN', 'ROLE_TEACHER')));
     $serviceKernel->setCurrentUser($currentUser);
     $this->serviceKernel = $serviceKernel;
 }
开发者ID:styling,项目名称:LeesPharm,代码行数:20,代码来源:BaseTestCase.php

示例3: AppKernel

}
use Symfony\Component\Debug\Debug;
use Topxia\Service\User\CurrentUser;
use Topxia\Service\Common\ServiceKernel;
use Symfony\Component\HttpFoundation\Request;
fix_gpc_magic();
$loader = (require_once __DIR__ . '/../app/bootstrap.php.cache');
Debug::enable();
require_once __DIR__ . '/../app/AppKernel.php';
$kernel = new AppKernel('dev', true);
$kernel->loadClassCache();
Request::enableHttpMethodParameterOverride();
$request = Request::createFromGlobals();
$kernel->boot();
// START: init service kernel
$serviceKernel = ServiceKernel::create($kernel->getEnvironment(), $kernel->isDebug());
$serviceKernel->setEnvVariable(array('host' => $request->getHttpHost(), 'schemeAndHost' => $request->getSchemeAndHttpHost(), 'basePath' => $request->getBasePath(), 'baseUrl' => $request->getSchemeAndHttpHost() . $request->getBasePath()));
$serviceKernel->setParameterBag($kernel->getContainer()->getParameterBag());
$serviceKernel->registerModuleDirectory(dirname(__DIR__) . '/plugins');
$serviceKernel->setConnection($kernel->getContainer()->get('database_connection'));
$serviceKernel->getConnection()->exec('SET NAMES UTF8');
$currentUser = new CurrentUser();
$currentUser->fromArray(array('id' => 0, 'nickname' => '游客', 'currentIp' => $request->getClientIp(), 'roles' => array()));
$serviceKernel->setCurrentUser($currentUser);
// END: init service kernel
// NOTICE: 防止请求捕捉失败而做异常处理
// 包括:数据库连接失败等
try {
    $response = $kernel->handle($request);
} catch (\RuntimeException $e) {
    echo "Error!  " . $e->getMessage();
开发者ID:robert-li-2015,项目名称:EduSoho,代码行数:31,代码来源:app_dev.php


注:本文中的AppKernel::isDebug方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。