2013-10-12 51 views
11

我在Symfony2配置文件中找到了一些預定義的參數, %kernel.root_dir%%kernel.debug%Symfony2預定義參數

  • 有沒有這些地方的綜合清單?

回答

16

它們在Symfony\Component\HttpKernel\Kernel.php;

/** 
* Returns the kernel parameters. 
* 
* @return array An array of kernel parameters 
*/ 
protected function getKernelParameters() 
{ 
    $bundles = array(); 
    foreach ($this->bundles as $name => $bundle) { 
     $bundles[$name] = get_class($bundle); 
    } 

    return array_merge(
     array(
      'kernel.root_dir'  => $this->rootDir, 
      'kernel.environment'  => $this->environment, 
      'kernel.debug'   => $this->debug, 
      'kernel.name'   => $this->name, 
      'kernel.cache_dir'  => $this->getCacheDir(), 
      'kernel.logs_dir'  => $this->getLogDir(), 
      'kernel.bundles'   => $bundles, 
      'kernel.charset'   => $this->getCharset(), 
      'kernel.container_class' => $this->getContainerClass(), 
     ), 
     $this->getEnvParameters() 
    ); 
} 
0

你也可以看到他們在app/cache/dev/appDevDebugProjectContainer.php:getDefaultParameters()(它在文件末尾),所有提供給您的應用程序中的其他參數。

/** 
* Gets the default parameters. 
* 
* @return array An array of the default parameters 
*/ 
protected function getDefaultParameters() 
{ 
    return array(
     'kernel.root_dir' => $this->targetDirs[2], 
     'kernel.environment' => 'dev', 
     'kernel.debug' => true, 
     'kernel.name' => 'app', 
     'kernel.cache_dir' => __DIR__, 
     'kernel.logs_dir' => ($this->targetDirs[2].'/logs'), 
     ... 
    ); 
}