Allow to configure sql/migrations dir (#459)
This commit is contained in:
parent
efada49f15
commit
59f3b4a738
|
@ -54,7 +54,7 @@ class MigrationDiffCommand extends WrappedCommand
|
|||
*/
|
||||
protected function getSubCommandArguments(InputInterface $input)
|
||||
{
|
||||
$defaultOutputDir = $this->getApplication()->getKernel()->getRootDir().'/propel/migrations';
|
||||
$defaultOutputDir = $this->getContainer()->getParameter('propel.configuration')['paths']['migrationDir'];
|
||||
|
||||
return array(
|
||||
'--connection' => $this->getConnections($input->getOption('connection')),
|
||||
|
|
|
@ -52,7 +52,7 @@ class MigrationDownCommand extends WrappedCommand
|
|||
*/
|
||||
protected function getSubCommandArguments(InputInterface $input)
|
||||
{
|
||||
$defaultOutputDir = $this->getApplication()->getKernel()->getRootDir().'/propel/migrations';
|
||||
$defaultOutputDir = $this->getContainer()->getParameter('propel.configuration')['paths']['migrationDir'];
|
||||
|
||||
return array(
|
||||
'--connection' => $this->getConnections($input->getOption('connection')),
|
||||
|
|
|
@ -52,7 +52,7 @@ class MigrationMigrateCommand extends WrappedCommand
|
|||
*/
|
||||
protected function getSubCommandArguments(InputInterface $input)
|
||||
{
|
||||
$defaultOutputDir = $this->getApplication()->getKernel()->getRootDir().'/propel/migrations';
|
||||
$defaultOutputDir = $this->getContainer()->getParameter('propel.configuration')['paths']['migrationDir'];
|
||||
|
||||
return array(
|
||||
'--connection' => $this->getConnections($input->getOption('connection')),
|
||||
|
|
|
@ -50,7 +50,7 @@ class MigrationStatusCommand extends WrappedCommand
|
|||
*/
|
||||
protected function getSubCommandArguments(InputInterface $input)
|
||||
{
|
||||
$defaultOutputDir = $this->getApplication()->getKernel()->getRootDir().'/propel/migrations';
|
||||
$defaultOutputDir = $this->getContainer()->getParameter('propel.configuration')['paths']['migrationDir'];
|
||||
|
||||
return array(
|
||||
'--connection' => $this->getConnections($input->getOption('connection')),
|
||||
|
|
|
@ -52,7 +52,7 @@ class MigrationUpCommand extends WrappedCommand
|
|||
*/
|
||||
protected function getSubCommandArguments(InputInterface $input)
|
||||
{
|
||||
$defaultOutputDir = $this->getApplication()->getKernel()->getRootDir().'/propel/migrations';
|
||||
$defaultOutputDir = $this->getContainer()->getParameter('propel.configuration')['paths']['migrationDir'];
|
||||
|
||||
return array(
|
||||
'--connection' => $this->getConnections($input->getOption('connection')),
|
||||
|
|
|
@ -47,7 +47,7 @@ class SqlBuildCommand extends WrappedCommand
|
|||
*/
|
||||
protected function getSubCommandArguments(InputInterface $input)
|
||||
{
|
||||
$defaultSqlDir = sprintf('%s/propel/sql', $this->getApplication()->getKernel()->getRootDir());
|
||||
$defaultSqlDir = $this->getContainer()->getParameter('propel.configuration')['paths']['sqlDir'];
|
||||
|
||||
return array(
|
||||
'--connection' => $this->getConnections($input->getOption('connection')),
|
||||
|
|
|
@ -59,7 +59,7 @@ class SqlInsertCommand extends WrappedCommand
|
|||
*/
|
||||
protected function getSubCommandArguments(InputInterface $input)
|
||||
{
|
||||
$defaultSqlDir = sprintf('%s/propel/sql', $this->getApplication()->getKernel()->getRootDir());
|
||||
$defaultSqlDir = $this->getContainer()->getParameter('propel.configuration')['paths']['sqlDir'];
|
||||
|
||||
return array(
|
||||
'--connection' => $this->getConnections($input->getOption('connection')),
|
||||
|
|
|
@ -19,10 +19,29 @@ use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
|
|||
class Configuration extends PropelConfiguration
|
||||
{
|
||||
private $debug;
|
||||
private $defaultDir;
|
||||
|
||||
public function __construct($debug = true)
|
||||
public function __construct($debug, $kernelDir)
|
||||
{
|
||||
$this->debug = $debug;
|
||||
$this->defaultDir = $kernelDir.'/propel';
|
||||
}
|
||||
|
||||
protected function addPathsSection(ArrayNodeDefinition $node)
|
||||
{
|
||||
$node
|
||||
->children()
|
||||
->arrayNode('paths')
|
||||
->addDefaultsIfNotSet()
|
||||
->children()
|
||||
->scalarNode('schemaDir')->defaultValue($this->defaultDir)->end()
|
||||
->scalarNode('sqlDir')->defaultValue($this->defaultDir.'/sql')->end()
|
||||
->scalarNode('migrationDir')->defaultValue($this->defaultDir.'/migrations')->end()
|
||||
->scalarNode('composerDir')->defaultNull()->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
;
|
||||
}
|
||||
|
||||
protected function addRuntimeSection(ArrayNodeDefinition $node)
|
||||
|
|
|
@ -58,7 +58,7 @@ class PropelExtension extends Extension
|
|||
|
||||
public function getConfiguration(array $config, ContainerBuilder $container)
|
||||
{
|
||||
return new Configuration($container->getParameter('kernel.debug'));
|
||||
return new Configuration($container->getParameter('kernel.debug'), $container->getParameter('kernel.root_dir'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue