Cleaned a bit the AbstractCommand
This commit is contained in:
parent
c6087f7191
commit
e3fb952229
|
@ -49,11 +49,15 @@ abstract class AbstractCommand extends ContainerAwareCommand
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Creates the instance of the Propel sub-command to execute.
|
||||||
|
*
|
||||||
* @return \Symfony\Component\Console\Command\Command
|
* @return \Symfony\Component\Console\Command\Command
|
||||||
*/
|
*/
|
||||||
protected abstract function createSubCommandInstance();
|
protected abstract function createSubCommandInstance();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Returns all the arguments and options needed by the Propel sub-command.
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected abstract function getSubCommandArguments(InputInterface $input);
|
protected abstract function getSubCommandArguments(InputInterface $input);
|
||||||
|
@ -90,7 +94,10 @@ abstract class AbstractCommand extends ContainerAwareCommand
|
||||||
|
|
||||||
protected function runCommand(Command $command, array $parameters, InputInterface $input, OutputInterface $output)
|
protected function runCommand(Command $command, array $parameters, InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
|
// add the command's name to the parameters
|
||||||
array_unshift($parameters, $this->getName());
|
array_unshift($parameters, $this->getName());
|
||||||
|
|
||||||
|
// merge the default parameters
|
||||||
$parameters = array_merge(array(
|
$parameters = array_merge(array(
|
||||||
'--input-dir' => $this->cacheDir,
|
'--input-dir' => $this->cacheDir,
|
||||||
'--verbose' => $input->getOption('verbose'),
|
'--verbose' => $input->getOption('verbose'),
|
||||||
|
@ -100,15 +107,15 @@ abstract class AbstractCommand extends ContainerAwareCommand
|
||||||
$parameters['--platform'] = $input->getOption('platform');
|
$parameters['--platform'] = $input->getOption('platform');
|
||||||
}
|
}
|
||||||
|
|
||||||
var_dump($parameters);
|
|
||||||
|
|
||||||
$commandInput = new ArrayInput($parameters);
|
|
||||||
|
|
||||||
$command->setApplication($this->getApplication());
|
$command->setApplication($this->getApplication());
|
||||||
|
|
||||||
return $command->run($commandInput, $output);
|
// and run the sub-command
|
||||||
|
return $command->run(new ArrayInput($parameters), $output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create all the files needed by Propel's commands.
|
||||||
|
*/
|
||||||
protected function setupBuildTimeFiles()
|
protected function setupBuildTimeFiles()
|
||||||
{
|
{
|
||||||
$kernel = $this->getApplication()->getKernel();
|
$kernel = $this->getApplication()->getKernel();
|
||||||
|
@ -133,11 +140,6 @@ abstract class AbstractCommand extends ContainerAwareCommand
|
||||||
protected function copySchemas(KernelInterface $kernel, $cacheDir)
|
protected function copySchemas(KernelInterface $kernel, $cacheDir)
|
||||||
{
|
{
|
||||||
$filesystem = new Filesystem();
|
$filesystem = new Filesystem();
|
||||||
|
|
||||||
if (!is_dir($cacheDir)) {
|
|
||||||
$filesystem->mkdir($cacheDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
$base = ltrim(realpath($kernel->getRootDir().'/..'), DIRECTORY_SEPARATOR);
|
$base = ltrim(realpath($kernel->getRootDir().'/..'), DIRECTORY_SEPARATOR);
|
||||||
|
|
||||||
$finalSchemas = $this->getFinalSchemas($kernel, $this->bundle);
|
$finalSchemas = $this->getFinalSchemas($kernel, $this->bundle);
|
||||||
|
@ -219,10 +221,6 @@ abstract class AbstractCommand extends ContainerAwareCommand
|
||||||
*/
|
*/
|
||||||
protected function createBuildTimeFile($file)
|
protected function createBuildTimeFile($file)
|
||||||
{
|
{
|
||||||
if (!$this->getContainer()->hasParameter('propel.configuration')) {
|
|
||||||
throw new \InvalidArgumentException('Could not find Propel configuration.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$xml = strtr(<<<EOT
|
$xml = strtr(<<<EOT
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<config>
|
<config>
|
||||||
|
|
Loading…
Reference in a new issue