Development

Changeset 8291

You must first sign up to be able to contribute.

Changeset 8291

Show
Ignore:
Timestamp:
04/04/08 16:41:43 (3 months ago)
Author:
francois
Message:

[doc 1.1] documented new way of writing a batch

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • doc/branches/1.1/book/06-Inside-the-Controller-Layer.txt

    r8289 r8291  
    9696    [php] 
    9797    <?php 
    98  
    99     define('SF_ROOT_DIR',    realpath(dirname(__FILE__).'/..')); 
    100     define('SF_APP',         'frontend'); 
    101     define('SF_ENVIRONMENT', 'prod'); 
    102     define('SF_DEBUG',       false); 
    103  
    104     require_once(SF_ROOT_DIR.DIRECTORY_SEPARATOR.'apps'.DIRECTORY_SEPARATOR.SF_APP.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php'); 
     98    require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php'); 
     99    $configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'dev', true); 
     100    sfContext::createInstance($configuration); 
    105101 
    106102    // add code here 
    107103 
    108 You can see that the only missing line is the call to the `dispatch()` method of the sfController object, which can be used only with a web server, not in a batch process. Defining an application and an environment gives you access to a specific configuration. Including the application `config.php` initiates the context and the autoloading
     104You can see that the only missing line is the call to the `dispatch()` method of the sfController object, which can be used only with a web server, not in a batch process. Defining an application and an environment gives you access to a specific configuration. Including the project configuration class initiates the context and the autoloading. Creating a context instance based on an application configuration class initializes all the symfony core objects and populates the `sfConfig` registry with the values from a given application and environment
    109105 
    110106Actions 
  • doc/branches/1.1/book/18-Performance.txt

    r8283 r8291  
    430430 
    431431    [php] 
    432     <?php 
    433  
    434     define('SF_ROOT_DIR',    realpath(dirname(__FILE__).'/..')); 
    435     define('SF_APP',         'frontend'); 
    436     define('SF_ENVIRONMENT', 'staging'); 
    437     define('SF_DEBUG',       false); 
    438  
    439     require_once(SF_ROOT_DIR.DIRECTORY_SEPARATOR.'apps'.DIRECTORY_SEPARATOR.SF_APP.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php'); 
     432    require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php'); 
     433    $configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'staging', false); 
     434    sfContext::createInstance($configuration); 
    440435 
    441436    // Array of URLs to browse