Removed command headers, fixed naming

This commit is contained in:
William DURAND 2012-05-09 01:04:22 +02:00
parent a99af5fffc
commit 590787d2b6
12 changed files with 21 additions and 34 deletions

View file

@ -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 <comment>%s</comment> in <comment>%s</comment> environment.',
$name, $this->getApplication()->getKernel()->getEnvironment()));
if (false === $this->alreadyWroteConnection) {
$output->writeln(sprintf('Use connection named <comment>%s</comment> in <comment>%s</comment> environment.',
$name, $this->getApplication()->getKernel()->getEnvironment())
);
$this->alreadyWroteConnection = true;
}
return array($name, $defaultConfig);
}

View file

@ -22,7 +22,7 @@ use Symfony\Component\HttpKernel\KernelInterface;
/**
* @author Toni Uebernickel <tuebernickel@gmail.com>
*/
class InitAclCommand extends SqlInsertCommand
class AclInitCommand extends SqlInsertCommand
{
protected function configure()
{
@ -40,13 +40,12 @@ The <info>--connection</info> 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';
}

View file

@ -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']);

View file

@ -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');

View file

@ -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('>> <info>File+</info> %s', $filename));
$this->writeNewFile($output, $filename);
return true;
}

View file

@ -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('<info>No SQL fixtures found.</info>');
$output->writeln('No <info>SQL</info> fixtures found.');
}
}
if ($input->getOption('xml') || $noOptions) {
if (-1 === $this->loadFixtures($input, $output, 'xml')) {
$output->writeln('<info>No XML fixtures found.</info>');
$output->writeln('No <info>XML</info> fixtures found.');
}
}
if ($input->getOption('yml') || $noOptions) {
if (-1 === $this->loadFixtures($input, $output, 'yml')) {
$output->writeln('<info>No YAML fixtures found.</info>');
$output->writeln('No <info>YML</info> fixtures found.');
}
}
}

View file

@ -16,11 +16,11 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
/**
* GraphvizCommand.
* GraphvizGenerateCommand.
*
* @author William DURAND <william.durand1@gmail.com>
*/
class GraphvizCommand extends AbstractCommand
class GraphvizGenerateCommand extends AbstractCommand
{
/**
* @see Command
@ -35,7 +35,7 @@ The <info>propel:graphviz</info> generates Graphviz file for your project.
<info>php app/console propel:graphviz</info>
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 <info>%s</info>.', $dest));
$this->writeNewDirectory($output, $dest);
}
}

View file

@ -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';
}

View file

@ -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';
}

View file

@ -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';
}

View file

@ -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';

View file

@ -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')) {