SVN Alba r5407 - prosistem/alba/trunk/alba/plugins/albaTasks/data/tasks
Author: ftoledo Date: 2008-01-16 18:20:01 -0200 (Wed, 16 Jan 2008) New Revision: 5407 Modified: prosistem/alba/trunk/alba/plugins/albaTasks/data/tasks/albaTasks.php Log: fix de la funcion propel-dump-data del CLI falla la funcion dumpData() del propel porque no se pasan los parametros correctos de conexion revisar en symfony si no esta resuelto o mandar un parche Modified: prosistem/alba/trunk/alba/plugins/albaTasks/data/tasks/albaTasks.php =================================================================== --- prosistem/alba/trunk/alba/plugins/albaTasks/data/tasks/albaTasks.php 2008-01-16 20:10:06 UTC (rev 5406) +++ prosistem/alba/trunk/alba/plugins/albaTasks/data/tasks/albaTasks.php 2008-01-16 20:20:01 UTC (rev 5407) @@ -6,7 +6,11 @@ pake_desc( 'Limpiar archivos temporales'); pake_task( 'alba-clear-temp','project_exists'); +pake_desc('[ALBA-fix] dump data to fixtures directory'); +pake_task('alba-dump-data', 'project_exists'); + + function run_alba_list_users( $task, $args ) { @@ -30,5 +34,72 @@ function run_alba_clear_temp ( $task, $args ) { pake_echo_action ('Limpiando archivos temporales...','Ok'); + pake_echo_action ("NO IMPLEMENTADO AUN"); } -?> + +/** + * La funcion original en dist/symfony/data/tasks/sfPakePropel.php + * NO FUNCIONA + * porque a la funcion dumpData() no se le pasan los parametros correctos + * + * + * Dumps yml database data to fixtures directory. + * + * @example symfony dump-data frontend data.yml + * @example symfony dump-data frontend data.yml dev + * + * @param object $task + * @param array $args + */ +function run_alba_dump_data($task, $args) +{ + if (!count($args)) + { + throw new Exception('You must provide the app.'); + } + + $app = $args[0]; + + if (!is_dir(sfConfig::get('sf_app_dir').DIRECTORY_SEPARATOR.$app)) + { + throw new Exception('The app "'.$app.'" does not exist.'); + } + + if (!isset($args[1])) + { + throw new Exception('You must provide a filename.'); + } + + $filename = $args[1]; + + $env = empty($args[2]) ? 'dev' : $args[2]; + + // define constants + define('SF_ROOT_DIR', sfConfig::get('sf_root_dir')); + define('SF_APP', $app); + define('SF_ENVIRONMENT', $env); + define('SF_DEBUG', true); + + // get configuration + require_once SF_ROOT_DIR.DIRECTORY_SEPARATOR.'apps'.DIRECTORY_SEPARATOR.SF_APP.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php'; + + $databaseManager = new sfDatabaseManager(); + $databaseManager->initialize(); + + if (!sfToolkit::isPathAbsolute($filename)) + { + $dir = sfConfig::get('sf_data_dir').DIRECTORY_SEPARATOR.'fixtures'; + pake_mkdirs($dir); + $filename = $dir.DIRECTORY_SEPARATOR.$filename; + } + + pake_echo_action('propel', sprintf('dumping data to "%s"', $filename)); + + $data = new sfPropelData(); + + // FIX de parametros + $data->dumpData($filename,'all','alba'); +} + + +?> \ No newline at end of file
participants (1)
-
commits@pressenter.com.ar