Improved commands

This commit is contained in:
William DURAND 2011-06-22 16:47:19 +02:00
parent 4f1cc4ce05
commit 35a56e8ca8
6 changed files with 16 additions and 6 deletions

View file

@ -39,10 +39,12 @@ EOT
protected function execute(InputInterface $input, OutputInterface $output)
{
if ($input->getOption('verbose')) {
$this->additionalPhingArgs[]= 'verbose';
$this->additionalPhingArgs[] = 'verbose';
}
if (true === $this->callPhing('om')) {
$this->writeSection($output, '[Propel] You are running the command: propel:build-model');
foreach ($this->tempSchemas as $schemaFile => $schemaDetails) {
$output->writeln(sprintf(
'Built Model classes for bundle <info>%s</info> from <comment>%s</comment>.',

View file

@ -43,10 +43,12 @@ EOT
protected function execute(InputInterface $input, OutputInterface $output)
{
if ($input->getOption('verbose')) {
$this->additionalPhingArgs[]= 'verbose';
$this->additionalPhingArgs[] = 'verbose';
}
if (true === $this->callPhing('sql', array('propel.packageObjectModel' => false))) {
$this->writeSection($output, '[Propel] You are running the command: propel:build-sql');
$filesystem = new Filesystem();
$basePath = $this->getApplication()->getKernel()->getRootDir(). DIRECTORY_SEPARATOR . 'propel'. DIRECTORY_SEPARATOR . 'sql';
$sqlMap = file_get_contents($basePath . DIRECTORY_SEPARATOR . 'sqldb.map');

View file

@ -33,6 +33,8 @@ class DatabaseCreateCommand extends PhingCommand
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->writeSection($output, '[Propel] You are running the command: propel:database:create');
list($name, $config) = $this->getConnection($input, $output);
$dbName = $this->parseDbName($config['connection']['dsn']);
$query = 'CREATE DATABASE '. $dbName .';';

View file

@ -45,6 +45,8 @@ EOT
protected function execute(InputInterface $input, OutputInterface $output)
{
if ($input->getOption('force')) {
$this->writeSection($output, '[Propel] You are running the command: propel:database:drop');
list($name, $config) = $this->getConnection($input, $output);
$dbName = $this->parseDbName($config['connection']['dsn']);
$query = 'DROP DATABASE '. $dbName .';';

View file

@ -45,6 +45,8 @@ EOT
protected function execute(InputInterface $input, OutputInterface $output)
{
if ($input->getOption('force')) {
$this->writeSection($output, '[Propel] You are running the command: propel:insert-sql');
list($name, $defaultConfig) = $this->getConnection($input, $output);
$ret = $this->callPhing('insert-sql', array(

View file

@ -79,18 +79,18 @@ EOT
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->writeSection($output, '[Propel] You are running the command: propel:load-fixtures');
$this->absoluteFixturesPath = $this->getApplication()->getKernel()->getRootDir() . DIRECTORY_SEPARATOR . $input->getOption('dir');
$this->filesystem = new Filesystem();
$noOptions = (!$input->getOption('xml') && !$input->getOption('sql'));
if ($input->getOption('xml') || $noOptions)
{
if ($input->getOption('xml') || $noOptions) {
$this->loadXmlFixtures($input, $output);
}
if ($input->getOption('sql') || $noOptions)
{
if ($input->getOption('sql') || $noOptions) {
$this->loadSqlFixtures($input, $output);
}