Development

Changeset 10075

You must first sign up to be able to contribute.

Changeset 10075

Show
Ignore:
Timestamp:
07/02/08 19:30:33 (2 months ago)
Author:
hartym
Message:

updated an error about how to initialize database, removed the final sentence which was aimed at the blog post only.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • doc/branches/1.1/cookbook/en/tasks.txt

    r9643 r10075  
    109109  * **Do you need the database layer?** 
    110110 
     111    To retrieve the database manager, we need to be in an application context. This is easily done by adding the special `application` argument. 
     112 
     113        [php] 
     114        protected function configure() 
     115        { 
     116          // ... 
     117 
     118          $this->addArgument('application', null, sfCommandOption::PARAMETER_OPTIONAL, 'Changes the environment this task is run in', 'prod'); 
     119 
     120          // ... 
     121        } 
     122 
     123    Now the `$this->configuration` class property contains an instance to the `sfApplicationConfiguration` instead of the default 
     124    `sfProjectConfiguration`, and you can use it to initialize the database manager: 
     125 
    111126        [php] 
    112127        protected function execute($arguments = array(), $options = array()) 
     
    125140  * **Need to let the user choose the environment, while providing a default one?** 
    126141 
    127    Just add the `env` option in the `::configure()` method and symfony will use its value as the environemnt. 
     142    Just add the `env` option in the `::configure()` method and symfony will use its value as the environemnt. 
    128143 
    129144        [php] 
    130145        $this->addOption('env', null, sfCommandOption::PARAMETER_OPTIONAL, 'Changes the environment this task is run in', 'prod'); 
    131146 
    132 What do you think? Isn't this some cherry on the cake, or for instance, some jazzy chorus over the symfony?