11

I find some predefined parameters in Symfony2 configuration files, ie. %kernel.root_dir%, %kernel.debug%.

  • Is there a comprehensive list of these somewhere?

2 Answers 2

16

They're under 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()
    );
}
Sign up to request clarification or add additional context in comments.

Comments

0

You can also see them in app/cache/dev/appDevDebugProjectContainer.php:getDefaultParameters() (it's at the end of the file), along with all the other parameters available to your application.

/**
 * 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'),
        ...
    );
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.