Cleaned a bit the TableDrop command
This commit is contained in:
parent
53db41026b
commit
2b7cbeacfb
|
@ -44,6 +44,10 @@ abstract class AbstractCommand extends ContainerAwareCommand
|
|||
*/
|
||||
protected $input;
|
||||
|
||||
|
||||
use FormattingHelpers;
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -380,36 +384,6 @@ EOT;
|
|||
return $this->cacheDir;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Comes from the SensioGeneratorBundle.
|
||||
* @see https://github.com/sensio/SensioGeneratorBundle/blob/master/Command/Helper/DialogHelper.php#L52
|
||||
*
|
||||
* @param OutputInterface $output The output.
|
||||
* @param string $text A text message.
|
||||
* @param string $style A style to apply on the section.
|
||||
*/
|
||||
protected function writeSection(OutputInterface $output, $text, $style = 'bg=blue;fg=white')
|
||||
{
|
||||
$output->writeln(array(
|
||||
'',
|
||||
$this->getHelperSet()->get('formatter')->formatBlock($text, $style, true),
|
||||
'',
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Ask confirmation from the user.
|
||||
*
|
||||
* @param OutputInterface $output The output.
|
||||
* @param string $question A given question.
|
||||
* @param string $default A default response.
|
||||
*/
|
||||
protected function askConfirmation(OutputInterface $output, $question, $default = null)
|
||||
{
|
||||
return $this->getHelperSet()->get('dialog')->askConfirmation($output, $question, $default);
|
||||
}
|
||||
|
||||
protected function arrayToIni(array $data)
|
||||
{
|
||||
$lines = array();
|
||||
|
|
48
Command/FormattingHelpers.php
Normal file
48
Command/FormattingHelpers.php
Normal file
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the PropelBundle package.
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @license MIT License
|
||||
*/
|
||||
|
||||
namespace Propel\PropelBundle\Command;
|
||||
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
/**
|
||||
* @author Kévin Gomez <contact@kevingomez.fr>
|
||||
*/
|
||||
trait FormattingHelpers
|
||||
{
|
||||
/**
|
||||
* Comes from the SensioGeneratorBundle.
|
||||
* @see https://github.com/sensio/SensioGeneratorBundle/blob/master/Command/Helper/DialogHelper.php#L52
|
||||
*
|
||||
* @param OutputInterface $output The output.
|
||||
* @param string $text A text message.
|
||||
* @param string $style A style to apply on the section.
|
||||
*/
|
||||
protected function writeSection(OutputInterface $output, $text, $style = 'bg=blue;fg=white')
|
||||
{
|
||||
$output->writeln(array(
|
||||
'',
|
||||
$this->getHelperSet()->get('formatter')->formatBlock($text, $style, true),
|
||||
'',
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Ask confirmation from the user.
|
||||
*
|
||||
* @param OutputInterface $output The output.
|
||||
* @param string $question A given question.
|
||||
* @param string $default A default response.
|
||||
*/
|
||||
protected function askConfirmation(OutputInterface $output, $question, $default = null)
|
||||
{
|
||||
return $this->getHelperSet()->get('dialog')->askConfirmation($output, $question, $default);
|
||||
}
|
||||
}
|
|
@ -11,6 +11,7 @@
|
|||
namespace Propel\PropelBundle\Command;
|
||||
|
||||
use Propel\Runtime\Propel;
|
||||
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
@ -19,8 +20,10 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||
/**
|
||||
* @author Kévin Gomez <contact@kevingomez.fr>
|
||||
*/
|
||||
class TableDropCommand extends AbstractCommand
|
||||
class TableDropCommand extends ContainerAwareCommand
|
||||
{
|
||||
use FormattingHelpers;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -110,20 +113,4 @@ class TableDropCommand extends AbstractCommand
|
|||
), 'fg=white;bg=red');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function createSubCommandInstance()
|
||||
{
|
||||
// useless for this command
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getSubCommandArguments(InputInterface $input)
|
||||
{
|
||||
// useless for this command
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue