Development

Changeset 8499

You must first sign up to be able to contribute.

Changeset 8499

Show
Ignore:
Timestamp:
04/17/08 09:22:28 (6 months ago)
Author:
francois
Message:

[doc1.1] Updated doc on tasks

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • doc/branches/1.1/book/16-Application-Management-Tools.txt

    r8405 r8499  
    399399    > php symfony 
    400400 
    401 Rather than writing a task skeleton by yourself, you can use the symfony `task:init` task. It creates an empty task, and has plenty of customization options. Make sure you check them by calling: 
    402  
    403     > php symfony help task:init 
     401Rather than writing a task skeleton by yourself, you can use the symfony `generate:task` task. It creates an empty task, and has plenty of customization options. Make sure you check them by calling: 
     402 
     403    > php symfony help generate:task 
    404404 
    405405Tasks can accept arguments (compulsory parameters, in a predefined order) and options (optional and unordered parameters). Listing 16-14 shows a more complete task, taking advantage of all these features. 
     
    437437 
    438438>**NOTE** 
    439 >If your task needs access to the database layer, it should extend `sfPropelBaseTask` instead of `sfBaseTask`. The task initialization will then take care of loading the additional Propel classes. The task can require an `application` and an `env` argument so that you can start a database connection in the `execute()` method by calling: 
    440 
    441 >    $configuration = ProjectConfiguration::getApplicationConfiguration($arguments['application'], $options['env'], true); 
    442 >    $databaseManager = new sfDatabaseManager($configuration); 
    443 
    444 >By default, skeletons generated by a call to `task:init` include this initialization. 
     439>If your task needs access to the database layer, it should extend `sfPropelBaseTask` instead of `sfBaseTask`. The task initialization will then take care of loading the additional Propel classes. You can start a database connection in the `execute()` method by calling: 
     440
     441>    $databaseManager = new sfDatabaseManager($this->configuration); 
     442
     443>If the task configuration defines an `application` and an `env` argument, they are automatically considered when building the task configuration, so that a task can use any of the database connections defined in your `databases.yml`. By default, skeletons generated by a call to `generate:task` include this initialization. 
    445444 
    446445For more examples on the abilities of the task system, check the source of existing symfony tasks.