dumpData() public method

Dumps data to fixture from one or more tables.
public dumpData ( string $directoryOrFile, mixed $tables = 'all', string $connectionName = 'propel' )
$directoryOrFile string The directory or file to dump to
$tables mixed The name or names of tables to dump (or all to dump all tables)
$connectionName string The connection name (default to propel)
コード例 #1
0
ファイル: alba.php プロジェクト: mediasadc/alba
/**
 * 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');
}
コード例 #2
0
 /**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     $databaseManager = new sfDatabaseManager($this->configuration);
     $filename = $arguments['target'];
     if (!is_null($filename) && !sfToolkit::isPathAbsolute($filename)) {
         $dir = sfConfig::get('sf_data_dir') . DIRECTORY_SEPARATOR . 'fixtures';
         $this->getFilesystem()->mkdirs($dir);
         $filename = $dir . DIRECTORY_SEPARATOR . $filename;
         $this->logSection('propel', sprintf('dumping data to "%s"', $filename));
     }
     $data = new sfPropelData();
     $classes = is_null($options['classes']) ? 'all' : explode(',', $options['classes']);
     if (!is_null($filename)) {
         $data->dumpData($filename, $classes, $options['connection']);
     } else {
         fwrite(STDOUT, sfYaml::dump($data->getData($classes, $options['connection']), 3));
     }
 }
コード例 #3
0
ファイル: pakePropel.php プロジェクト: emildev35/processmaker
/**
 * 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_propel_dump_data($task, $args)
{
    $filename = 'demo.sql';
    $app = 'app';
    $env = 'dev';
    // define constants
    define('SF_ROOT_DIR', PATH_CORE . 'config');
    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();
    pake_echo_action('propel', sprintf('dumping data to "%s"', $filename));
    $data = new sfPropelData();
    $data->dumpData($filename);
}