Misc. tweaks.
This commit is contained in:
parent
a3c39fedcc
commit
e50b27626b
@ -84,15 +84,11 @@ class Doctrine_Cli
|
||||
*/
|
||||
public function run($args)
|
||||
{
|
||||
echo "\n";
|
||||
|
||||
try {
|
||||
$this->_run($args);
|
||||
} catch (Exception $exception) {
|
||||
$this->notifyException($exception);
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
protected function _getTaskClassFromArgs($args)
|
||||
|
@ -110,7 +110,7 @@ class Doctrine_Data_Export extends Doctrine_Data
|
||||
}
|
||||
} else {
|
||||
if (is_dir($directory)) {
|
||||
throw new Doctrine_Data_Exception('You must specify the path to a '.$format.' file to export. You specified a directory.');
|
||||
$directory .= DIRECTORY_SEPARATOR . 'data.' . $format;
|
||||
}
|
||||
|
||||
if ( ! empty($data)) {
|
||||
|
@ -123,6 +123,10 @@ class Doctrine_Export_Schema
|
||||
{
|
||||
$array = $this->buildSchema($directory, $models);
|
||||
|
||||
if (is_dir($schema)) {
|
||||
$schema = $schema . DIRECTORY_SEPARATOR . 'schema.' . $format;
|
||||
}
|
||||
|
||||
return Doctrine_Parser::dump($array, $format, $schema);
|
||||
}
|
||||
}
|
@ -35,25 +35,19 @@ class Doctrine_Task_DumpData extends Doctrine_Task
|
||||
public $description = 'Dump data to a yaml data fixture file.',
|
||||
$requiredArguments = array('data_fixtures_path' => 'Specify path to write the yaml data fixtures file to.',
|
||||
'models_path' => 'Specify path to your Doctrine_Record definitions.'),
|
||||
$optionalArguments = array('individual_files' => 'Specify whether or not you want to dump to individual files. One file per model.');
|
||||
$optionalArguments = array();
|
||||
|
||||
public function execute()
|
||||
{
|
||||
Doctrine::loadModels($this->getArgument('models_path'));
|
||||
|
||||
$individualFiles = $this->getArgument('individual_files') ? true:false;
|
||||
|
||||
$path = $this->getArgument('data_fixtures_path');
|
||||
|
||||
if ( ! $individualFiles) {
|
||||
$e = explode('.', $this->getArgument('data_fixtures_path'));
|
||||
|
||||
if (end($e) !== 'yml') {
|
||||
$path = $this->getArgument('data_fixtures_path'). DIRECTORY_SEPARATOR . 'data.yml';
|
||||
}
|
||||
if (is_array($path)) {
|
||||
$path = $path[0];
|
||||
}
|
||||
|
||||
Doctrine::dumpData($path, $individualFiles);
|
||||
Doctrine::dumpData($path);
|
||||
|
||||
$this->dispatcher->notify(sprintf('Dumped data successfully to: %s', $path));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user