Development

Changeset 8150

You must first sign up to be able to contribute.

Changeset 8150

Show
Ignore:
Timestamp:
03/29/08 09:25:15 (1 year ago)
Author:
fabien
Message:

added a classes option to propel:data-dump task to dump only selected tables

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.1/lib/plugins/sfPropelPlugin/lib/propel/sfPropelData.class.php

    r8112 r8150  
    314314   * Returns data from one or more tables. 
    315315   * 
    316    * @param  string directory or file to dump to 
    317316   * @param  mixed  name or names of tables to dump (or all to dump all tables) 
    318317   * @param  string connection name 
  • branches/1.1/lib/plugins/sfPropelPlugin/lib/task/sfPropelDataDumpTask.class.php

    r7962 r8150  
    3434      new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environement', 'dev'), 
    3535      new sfCommandOption('connection', null, sfCommandOption::PARAMETER_REQUIRED, 'The connection name', 'propel'), 
     36      new sfCommandOption('classes', null, sfCommandOption::PARAMETER_REQUIRED, 'The class names to dump (separated by a colon)', null), 
    3637    )); 
    3738 
     
    6162 
    6263  [./symfony propel:data-load --connection="name" frontend|INFO] 
     64 
     65If you only want to dump some classes, use the [classes|COMMENT] option: 
     66 
     67  [./symfony propel:data-load --classes="Article,Category" frontend|INFO] 
    6368EOF; 
    6469  } 
     
    8590    $data = new sfPropelData(); 
    8691 
     92    $classes = is_null($options['classes']) ? 'all' : explode(',', $options['classes']); 
     93 
    8794    if (!is_null($filename)) 
    8895    { 
    89       $data->dumpData($filename, 'all', $options['connection']); 
     96      $data->dumpData($filename, $classes, $options['connection']); 
    9097    } 
    9198    else 
    9299    { 
    93       fwrite(STDOUT, sfYaml::dump($data->getData('all', $options['connection']), 3)); 
     100      fwrite(STDOUT, sfYaml::dump($data->getData($classes, $options['connection']), 3)); 
    94101    } 
    95102  } 

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting, and supporting several large Open-Source projects.