Symfonyバッチスクリプトのテンプレ

Symfony 0.6対応のバッチスクリプトのテンプレです。 batch/以下にスクリプトを配備して

php ./batch/script-name.php

などとして実行します。

< ?php
define('SF_ROOT_DIR',    realpath(dirname(__FILE__).'/..'));
define('SF_APP',         'frontend');
define('SF_ENVIRONMENT', 'dev');
define('SF_DEBUG',       false);
 
require_once(SF_ROOT_DIR.DIRECTORY_SEPARATOR.'apps'.DIRECTORY_SEPARATOR.SF_APP.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php');
// データベース接続を利用するなら下の一行を追加
sfContext::getInstance();
 
//
//ここにバッチスクリプトを書く
//
?>

Leave a Reply

You must be logged in to post a comment.