Code snippets for symfony 1.x


Refine Tags

Snippets tagged "propel batch"

Use the model in a batch or a test

To use database connections defined in the databases.yml configuration file, you can use the following snippet:

// initialize database manager
$databaseManager = new sfDatabaseManager();
by Fabien Potencier on 2006-05-21, tagged batch  configuration  propel  test 

Load data batch

Create a batch/load_data.php script with:

define('SF_ROOT_DIR',    realpath(dirname(__FILE__).'/..'));
define('SF_APP',         'frontend');
define('SF_ENVIRONMENT', 'dev');
define('SF_DEBUG',       true);
// initialize database manager
$databaseManager = new sfDatabaseManager();
$data = new sfPropelData();

Call it with:

$ cd batch
$ php load_data.php

It will load the data contained in all the .yml files of the data/fixtures/ directory.

by Francois Zaninotto on 2006-05-20, tagged batch  data  propel