diff --git a/Command/AbstractCommand.php b/Command/AbstractCommand.php index b1b3ea5..1f646b9 100644 --- a/Command/AbstractCommand.php +++ b/Command/AbstractCommand.php @@ -55,6 +55,11 @@ abstract class AbstractCommand extends ContainerAwareCommand */ protected $bundle = null; + /** + * @var Boolean + */ + private $alreadyWroteConnection = false; + /** * Return the package prefix for a given bundle. * @@ -436,8 +441,12 @@ EOT; throw new \InvalidArgumentException(sprintf('Connection named %s doesn\'t exist', $name)); } - $output->writeln(sprintf('Use connection named %s in %s environment.', - $name, $this->getApplication()->getKernel()->getEnvironment())); + if (false === $this->alreadyWroteConnection) { + $output->writeln(sprintf('Use connection named %s in %s environment.', + $name, $this->getApplication()->getKernel()->getEnvironment()) + ); + $this->alreadyWroteConnection = true; + } return array($name, $defaultConfig); } diff --git a/Command/InitAclCommand.php b/Command/AclInitCommand.php similarity index 95% rename from Command/InitAclCommand.php rename to Command/AclInitCommand.php index 68ac4ef..7821eed 100644 --- a/Command/InitAclCommand.php +++ b/Command/AclInitCommand.php @@ -22,7 +22,7 @@ use Symfony\Component\HttpKernel\KernelInterface; /** * @author Toni Uebernickel */ -class InitAclCommand extends SqlInsertCommand +class AclInitCommand extends SqlInsertCommand { protected function configure() { @@ -40,13 +40,12 @@ The --connection parameter allows you to change the connection to u The default connection is the active connection (propel.dbal.default_connection). EOT ) - ->setName('propel:init:acl') + ->setName('propel:acl:init') ; } protected function execute(InputInterface $input, OutputInterface $output) { - $this->writeSection($output, '[Propel] You are running the command: propel:init:acl'); if ($input->getOption('verbose')) { $this->additionalPhingArgs[] = 'verbose'; } diff --git a/Command/DatabaseCreateCommand.php b/Command/DatabaseCreateCommand.php index 060aaaf..858c364 100644 --- a/Command/DatabaseCreateCommand.php +++ b/Command/DatabaseCreateCommand.php @@ -41,8 +41,6 @@ class DatabaseCreateCommand extends AbstractCommand */ 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']); diff --git a/Command/DatabaseDropCommand.php b/Command/DatabaseDropCommand.php index 4f332ad..287dc59 100644 --- a/Command/DatabaseDropCommand.php +++ b/Command/DatabaseDropCommand.php @@ -52,8 +52,6 @@ EOT */ protected function execute(InputInterface $input, OutputInterface $output) { - $this->writeSection($output, '[Propel] You are running the command: propel:database:drop'); - if ($input->getOption('force')) { if ('prod' === $this->getApplication()->getKernel()->getEnvironment()) { $this->writeSection($output, 'WARNING: you are about to drop a database in production !', 'bg=red;fg=white'); diff --git a/Command/FixturesDumpCommand.php b/Command/FixturesDumpCommand.php index 5b8840e..ebfd20f 100644 --- a/Command/FixturesDumpCommand.php +++ b/Command/FixturesDumpCommand.php @@ -57,8 +57,6 @@ EOT */ protected function execute(InputInterface $input, OutputInterface $output) { - $this->writeSection($output, '[Propel] You are running the command: propel:fixtures:dump'); - list($name, $defaultConfig) = $this->getConnection($input, $output); $path = realpath($this->getApplication()->getKernel()->getRootDir() . '/../') . '/' . $this->defaultFixturesDir; @@ -77,8 +75,7 @@ EOT return false; } - $output->writeln(''); - $output->writeln(sprintf('>> File+ %s', $filename)); + $this->writeNewFile($output, $filename); return true; } diff --git a/Command/FixturesLoadCommand.php b/Command/FixturesLoadCommand.php index bb90605..75801b1 100644 --- a/Command/FixturesLoadCommand.php +++ b/Command/FixturesLoadCommand.php @@ -118,8 +118,6 @@ EOT */ protected function execute(InputInterface $input, OutputInterface $output) { - $this->writeSection($output, '[Propel] You are running the command: propel:fixtures:load'); - $this->filesystem = new Filesystem(); if (null !== $this->bundle) { @@ -142,19 +140,19 @@ EOT if ($input->getOption('sql') || $noOptions) { if (-1 === $this->loadSqlFixtures($input, $output)) { - $output->writeln('No SQL fixtures found.'); + $output->writeln('No SQL fixtures found.'); } } if ($input->getOption('xml') || $noOptions) { if (-1 === $this->loadFixtures($input, $output, 'xml')) { - $output->writeln('No XML fixtures found.'); + $output->writeln('No XML fixtures found.'); } } if ($input->getOption('yml') || $noOptions) { if (-1 === $this->loadFixtures($input, $output, 'yml')) { - $output->writeln('No YAML fixtures found.'); + $output->writeln('No YML fixtures found.'); } } } diff --git a/Command/GraphvizCommand.php b/Command/GraphvizGenerateCommand.php similarity index 81% rename from Command/GraphvizCommand.php rename to Command/GraphvizGenerateCommand.php index 871ecde..fd197ea 100644 --- a/Command/GraphvizCommand.php +++ b/Command/GraphvizGenerateCommand.php @@ -16,11 +16,11 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; /** - * GraphvizCommand. + * GraphvizGenerateCommand. * * @author William DURAND */ -class GraphvizCommand extends AbstractCommand +class GraphvizGenerateCommand extends AbstractCommand { /** * @see Command @@ -35,7 +35,7 @@ The propel:graphviz generates Graphviz file for your project. php app/console propel:graphviz EOT ) - ->setName('propel:graphviz') + ->setName('propel:graphviz:generate') ; } @@ -46,14 +46,12 @@ EOT */ protected function execute(InputInterface $input, OutputInterface $output) { - $this->writeSection($output, '[Propel] You are running the command: propel:graphviz'); - $dest = $this->getApplication()->getKernel()->getRootDir() . '/propel/graph/'; $this->callPhing('graphviz', array( 'propel.graph.dir' => $dest, )); - $output->writeln(sprintf('Graphviz file is in %s.', $dest)); + $this->writeNewDirectory($output, $dest); } } diff --git a/Command/ModelBuildCommand.php b/Command/ModelBuildCommand.php index 9ddbfeb..6a659c2 100644 --- a/Command/ModelBuildCommand.php +++ b/Command/ModelBuildCommand.php @@ -48,8 +48,6 @@ EOT */ protected function execute(InputInterface $input, OutputInterface $output) { - $this->writeSection($output, '[Propel] You are running the command: propel:model:build'); - if ($input->getOption('verbose')) { $this->additionalPhingArgs[] = 'verbose'; } diff --git a/Command/ReverseCommand.php b/Command/ReverseCommand.php index c63ae04..4d6d08f 100644 --- a/Command/ReverseCommand.php +++ b/Command/ReverseCommand.php @@ -52,8 +52,6 @@ EOT */ protected function execute(InputInterface $input, OutputInterface $output) { - $this->writeSection($output, '[Propel] You are running the command: propel:reverse'); - if ($input->getOption('verbose')) { $this->additionalPhingArgs[] = 'verbose'; } diff --git a/Command/SqlBuildCommand.php b/Command/SqlBuildCommand.php index 80acce3..93fe459 100644 --- a/Command/SqlBuildCommand.php +++ b/Command/SqlBuildCommand.php @@ -52,8 +52,6 @@ EOT */ protected function execute(InputInterface $input, OutputInterface $output) { - $this->writeSection($output, '[Propel] You are running the command: propel:sql:build'); - if ($input->getOption('verbose')) { $this->additionalPhingArgs[] = 'verbose'; } diff --git a/Command/SqlInsertCommand.php b/Command/SqlInsertCommand.php index e54bd24..8a2881b 100644 --- a/Command/SqlInsertCommand.php +++ b/Command/SqlInsertCommand.php @@ -55,8 +55,6 @@ EOT // Bad require but needed :( require_once $this->getContainer()->getParameter('propel.path') . '/generator/lib/util/PropelSqlManager.php'; - $this->writeSection($output, '[Propel] You are running the command: propel:sql:insert'); - if ($input->getOption('force')) { if ($input->getOption('verbose')) { $this->additionalPhingArgs[] = 'verbose'; diff --git a/Command/TableDropCommand.php b/Command/TableDropCommand.php index 2511606..a257970 100644 --- a/Command/TableDropCommand.php +++ b/Command/TableDropCommand.php @@ -55,8 +55,6 @@ EOT */ protected function execute(InputInterface $input, OutputInterface $output) { - $this->writeSection($output, '[Propel] You are running the command: propel:table:drop'); - $tablesToDelete = $input->getArgument('table'); if ($input->getOption('force')) {