SUBSCRIBE VIA RSS


Subscribe to our feed

Symfony Experts

Symfony Experts
If you have an urgent question for a symfony-related issue, this is the place to ask.

Topics

Stack Overflow


The old fashioned way

RECENT TUNES

July 16, 2007 – 11:57am Symfony init-batch

Before version 1.0 I was writing my batch scripts by hand, usually cutting and pasting from other batch scripts. At some point the

init-batch

command became available. This is how it works:

symfony init-batch default [yourBatchName] [yourApplicationName]

This creates a new file in your project/batch directory with the following content:

<?php
 
/**
 * yourBatchName batch script
 *
 * Here goes a brief description of the purpose of the batch script
 *
 * @package    yourProject
 * @subpackage batch
 * @version    $Id$
 */
 
define('SF_ROOT_DIR',    realpath(dirname(__file__).'/..'));
define('SF_APP',         'yourApplicationName');
define('SF_ENVIRONMENT', 'dev');
define('SF_DEBUG',       1);
 
require_once(SF_ROOT_DIR.DIRECTORY_SEPARATOR.'apps'.DIRECTORY_SEPARATOR.SF_APP.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php');
 
// initialize database manager
//$databaseManager = new sfDatabaseManager();
//$databaseManager->initialize();
 
// batch process here

Nice! Credit goes to those who posted in the forum for details about this great command line tool.

Posted by in  Uncategorized   |  

2 Responses to Symfony init-batch

  1. Pingback: rpsblog.com » A week of symfony #29 (16-&gt;22 July 2007)

  2. mo says:

    fyi – init-batch is gone in symfony 1.1

    look up how to create a task in symfony.