2012年9月4日 星期二

symfony Environment


http://symfony.com/doc/current/book/page_creation.html#environments

Before you begin: Create the Bundle

To create a bundle called AcmeHelloBundle (a play bundle that you'll build in this chapter), run the following command and follow the on-screen instructions (use all of the default options):

$ php app/console generate:bundle --namespace=Acme/HelloBundle --format=yml 
/opt/lampp/bin/php /home/d68fbe50/htdocs/Symfony/app/console generate:bundle --namespace=Acme/HelloBundle --format=yml 
Behind the scenes, a directory is created for the bundle at src/Acme/HelloBundle. A line is also automatically added to the app/AppKernel.php file so that the bundle is registered with the kernel:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
// app/AppKernel.php
public function registerBundles()
{
    $bundles = array(
        // ...
        new Acme\HelloBundle\AcmeHelloBundle(),
    );
    // ...

    return $bundles;
}

Environment Configuration

The AppKernel class is responsible for actually loading the configuration file of your choice:
1
2
3
4
5
// app/AppKernel.php
public function registerContainerConfiguration(LoaderInterface $loader)
{
    $loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
}

沒有留言:

張貼留言