本文整理汇总了PHP中Nette\Environment::isConsole方法的典型用法代码示例。如果您正苦于以下问题:PHP Environment::isConsole方法的具体用法?PHP Environment::isConsole怎么用?PHP Environment::isConsole使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Environment
的用法示例。
在下文中一共展示了Environment::isConsole方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: canonicalize
public function canonicalize()
{
// override canonization when running PHPUnit tests
if (!Environment::isConsole()) {
parent::canonicalize();
}
}
示例2: Route
// 2a) enable Nette\Debug for better exception and error visualisation
Debug::$strictMode = TRUE;
Debug::enable();
// 2b) load configuration from config.ini file
Environment::loadConfig();
// Step 3: Configure application
// 3a) get and setup a front controller
$application = Environment::getApplication();
$application->errorPresenter = 'Error';
//$application->catchExceptions = TRUE;
// Step 4: Setup application router
$router = $application->getRouter();
$router[] = new Route('index.php', array('presenter' => 'Homepage', 'action' => 'default'), Route::ONE_WAY);
$router[] = new Route('<presenter>/<id [0-9]+>', array('action' => 'show'));
$router[] = new Route('<presenter>/<action>/<id>', array('presenter' => 'Homepage', 'action' => 'default', 'id' => NULL));
// Doctrine configuration
$arrayCache = new ArrayCache();
$doctrineConfig = new Configuration();
$doctrineConfig->setMetadataCacheImpl($arrayCache);
$doctrineConfig->setQueryCacheImpl($arrayCache);
$doctrineConfig->setMetadataDriverImpl($doctrineConfig->newDefaultAnnotationDriver(array(APP_DIR . '/models')));
$doctrineConfig->setProxyNamespace('DoctrineProxy');
$doctrineConfig->setProxyDir(TEMP_DIR . '/cache');
//$doctrineConfig->setSQLLogger(Doctrine2Panel::getAndRegister());
$entityManager = EntityManager::create(Environment::getConfig('database')->toArray(), $doctrineConfig);
$application->getContext()->addService('Doctrine\\ORM\\EntityManager', $entityManager);
// Step 5: Run the application!
// Don't run while running PHPUnit tests
if (!Environment::isConsole()) {
$application->run();
}