Changeset 10075
- Timestamp:
- 07/02/08 19:30:33 (2 months ago)
- Files:
-
- doc/branches/1.1/cookbook/en/tasks.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
doc/branches/1.1/cookbook/en/tasks.txt
r9643 r10075 109 109 * **Do you need the database layer?** 110 110 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 111 126 [php] 112 127 protected function execute($arguments = array(), $options = array()) … … 125 140 * **Need to let the user choose the environment, while providing a default one?** 126 141 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. 128 143 129 144 [php] 130 145 $this->addOption('env', null, sfCommandOption::PARAMETER_OPTIONAL, 'Changes the environment this task is run in', 'prod'); 131 146 132 What do you think? Isn't this some cherry on the cake, or for instance, some jazzy chorus over the symfony?