Changeset 4624
- Timestamp:
- 07/16/07 14:38:05 (1 year ago)
- Files:
-
- trunk/data/tasks/sfPakePropel.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/data/tasks/sfPakePropel.php
r4594 r4624 283 283 * Loads yml data from fixtures directory and inserts into database. 284 284 * 285 * @example symfony load-data frontend 286 * @example symfony load-data frontend dev fixtures append 287 * 288 * @todo replace delete argument with flag -d 285 * @example symfony propel-load-data frontend 286 * @example symfony --env=dev --dir[]=data/fixtures --append propel-load-data frontend 289 287 * 290 288 * @param object $task 291 * @param array $args289 * @param array $args 292 290 */ 293 function run_propel_load_data($task, $args )291 function run_propel_load_data($task, $args, $options) 294 292 { 295 293 if (!count($args)) … … 302 300 if (!is_dir(sfConfig::get('sf_app_dir').DIRECTORY_SEPARATOR.$app)) 303 301 { 304 throw new Exception( 'The app "'.$app.'" does not exist.');305 } 306 307 if ( count($args) > 1 && $args[count($args) - 1] == 'append')302 throw new Exception(sprintf('The app "%s" does not exist.', $app)); 303 } 304 305 if (isset($options['append'])) 308 306 { 309 307 array_pop($args); … … 315 313 } 316 314 317 $env = empty($args[1]) ? 'dev' : $args[1];315 $env = isset($options['env']) ? $options['env'] : 'dev'; 318 316 319 317 // define constants … … 326 324 require_once SF_ROOT_DIR.DIRECTORY_SEPARATOR.'apps'.DIRECTORY_SEPARATOR.SF_APP.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php'; 327 325 328 if (count($args) == 1) 326 if (isset($options['dir[]'])) 327 { 328 $fixtures_dirs = $options['dir[]']; 329 } 330 else 329 331 { 330 332 if (!$pluginDirs = glob(sfConfig::get('sf_root_dir').'/plugins/*/data')) … … 333 335 } 334 336 $fixtures_dirs = pakeFinder::type('dir')->name('fixtures')->in(array_merge($pluginDirs, array(sfConfig::get('sf_data_dir')))); 335 }336 else337 {338 $fixtures_dirs = array_slice($args, 1);339 337 } 340 338