Do not ignore build properties and behaviors given in the configuration anymore
This commit is contained in:
parent
1b19c108ef
commit
bfef3c6460
|
@ -88,7 +88,10 @@ abstract class AbstractCommand extends ContainerAwareCommand
|
|||
{
|
||||
parent::initialize($input, $output);
|
||||
|
||||
$kernel = $this->getApplication()->getKernel();
|
||||
|
||||
$this->input = $input;
|
||||
$this->cacheDir = $kernel->getCacheDir().'/propel';
|
||||
|
||||
$this->checkConfiguration();
|
||||
|
||||
|
@ -127,7 +130,6 @@ abstract class AbstractCommand extends ContainerAwareCommand
|
|||
protected function setupBuildTimeFiles()
|
||||
{
|
||||
$kernel = $this->getApplication()->getKernel();
|
||||
$this->cacheDir = $kernel->getCacheDir().'/propel';
|
||||
|
||||
$fs = new Filesystem();
|
||||
$fs->mkdir($this->cacheDir);
|
||||
|
@ -316,13 +318,13 @@ EOT;
|
|||
protected function createBuildPropertiesFile(KernelInterface $kernel, $file)
|
||||
{
|
||||
$fs = new Filesystem();
|
||||
$buildPropertiesFile = $kernel->getRootDir().'/config/propel.ini';
|
||||
|
||||
if ($fs->exists($file)) {
|
||||
$fs->copy($buildPropertiesFile, $file);
|
||||
} else {
|
||||
$fs->touch($file);
|
||||
}
|
||||
$buildProperties = array_merge(
|
||||
parse_ini_file($kernel->getRootDir().'/config/propel.ini'),
|
||||
$this->getContainer()->getParameter('propel.build_properties')
|
||||
);
|
||||
|
||||
$fs->dumpFile($file, $this->arrayToIni($buildProperties));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -377,4 +379,15 @@ EOT;
|
|||
{
|
||||
return $this->cacheDir;
|
||||
}
|
||||
|
||||
protected function arrayToIni(array $data)
|
||||
{
|
||||
$lines = array();
|
||||
|
||||
foreach ($data as $key => $value) {
|
||||
$lines[] = $key . ' =' . (!empty($value) ? ' ' . $value : '');
|
||||
}
|
||||
|
||||
return implode(PHP_EOL, $lines);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,7 +52,6 @@ class PropelExtension extends Extension
|
|||
}
|
||||
|
||||
// build properties
|
||||
// @todo: store them as container parameters and use them in commands
|
||||
if (isset($config['build_properties']) && is_array($config['build_properties'])) {
|
||||
$buildProperties = $config['build_properties'];
|
||||
} else {
|
||||
|
@ -66,6 +65,8 @@ class PropelExtension extends Extension
|
|||
}
|
||||
}
|
||||
|
||||
$container->setParameter('propel.build_properties', $buildProperties);
|
||||
|
||||
if (!empty($config['dbal'])) {
|
||||
$this->dbalLoad($config['dbal'], $container);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue