Misc. tweaks.
This commit is contained in:
parent
a3c39fedcc
commit
e50b27626b
@ -84,15 +84,11 @@ class Doctrine_Cli
|
|||||||
*/
|
*/
|
||||||
public function run($args)
|
public function run($args)
|
||||||
{
|
{
|
||||||
echo "\n";
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->_run($args);
|
$this->_run($args);
|
||||||
} catch (Exception $exception) {
|
} catch (Exception $exception) {
|
||||||
$this->notifyException($exception);
|
$this->notifyException($exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _getTaskClassFromArgs($args)
|
protected function _getTaskClassFromArgs($args)
|
||||||
|
@ -110,7 +110,7 @@ class Doctrine_Data_Export extends Doctrine_Data
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (is_dir($directory)) {
|
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)) {
|
if ( ! empty($data)) {
|
||||||
|
@ -123,6 +123,10 @@ class Doctrine_Export_Schema
|
|||||||
{
|
{
|
||||||
$array = $this->buildSchema($directory, $models);
|
$array = $this->buildSchema($directory, $models);
|
||||||
|
|
||||||
|
if (is_dir($schema)) {
|
||||||
|
$schema = $schema . DIRECTORY_SEPARATOR . 'schema.' . $format;
|
||||||
|
}
|
||||||
|
|
||||||
return Doctrine_Parser::dump($array, $format, $schema);
|
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.',
|
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.',
|
$requiredArguments = array('data_fixtures_path' => 'Specify path to write the yaml data fixtures file to.',
|
||||||
'models_path' => 'Specify path to your Doctrine_Record definitions.'),
|
'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()
|
public function execute()
|
||||||
{
|
{
|
||||||
Doctrine::loadModels($this->getArgument('models_path'));
|
Doctrine::loadModels($this->getArgument('models_path'));
|
||||||
|
|
||||||
$individualFiles = $this->getArgument('individual_files') ? true:false;
|
|
||||||
|
|
||||||
$path = $this->getArgument('data_fixtures_path');
|
$path = $this->getArgument('data_fixtures_path');
|
||||||
|
|
||||||
if ( ! $individualFiles) {
|
if (is_array($path)) {
|
||||||
$e = explode('.', $this->getArgument('data_fixtures_path'));
|
$path = $path[0];
|
||||||
|
|
||||||
if (end($e) !== 'yml') {
|
|
||||||
$path = $this->getArgument('data_fixtures_path'). DIRECTORY_SEPARATOR . 'data.yml';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Doctrine::dumpData($path, $individualFiles);
|
Doctrine::dumpData($path);
|
||||||
|
|
||||||
$this->dispatcher->notify(sprintf('Dumped data successfully to: %s', $path));
|
$this->dispatcher->notify(sprintf('Dumped data successfully to: %s', $path));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user