Revert "Removed useless buildtime-conf file generation"
This reverts commit bca3140e98
.
Conflicts:
Command/AbstractCommand.php
This commit is contained in:
parent
88b2863fad
commit
bfab444695
|
@ -123,6 +123,9 @@ abstract class AbstractCommand extends ContainerAwareCommand
|
||||||
|
|
||||||
// build.properties
|
// build.properties
|
||||||
$this->createBuildPropertiesFile($kernel, $this->cacheDir.'/build.properties');
|
$this->createBuildPropertiesFile($kernel, $this->cacheDir.'/build.properties');
|
||||||
|
|
||||||
|
// buildtime-conf.xml
|
||||||
|
$this->createBuildTimeFile($this->cacheDir.'/buildtime-conf.xml');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -239,6 +242,57 @@ abstract class AbstractCommand extends ContainerAwareCommand
|
||||||
return $finalSchemas;
|
return $finalSchemas;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create an XML file which represents propel.configuration
|
||||||
|
*
|
||||||
|
* @param string $file Should be 'buildtime-conf.xml'.
|
||||||
|
*/
|
||||||
|
protected function createBuildTimeFile($file)
|
||||||
|
{
|
||||||
|
if (!$this->getContainer()->hasParameter('propel.configuration')) {
|
||||||
|
throw new \InvalidArgumentException('Could not find Propel configuration.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$xml = strtr(<<<EOT
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<config>
|
||||||
|
<propel>
|
||||||
|
<datasources default="%default_connection%">
|
||||||
|
|
||||||
|
EOT
|
||||||
|
, array('%default_connection%' => $this->getContainer()->getParameter('propel.dbal.default_connection')));
|
||||||
|
|
||||||
|
$datasources = $this->getContainer()->getParameter('propel.configuration');
|
||||||
|
foreach ($datasources as $name => $datasource) {
|
||||||
|
$xml .= strtr(<<<EOT
|
||||||
|
<datasource id="%name%">
|
||||||
|
<adapter>%adapter%</adapter>
|
||||||
|
<connection>
|
||||||
|
<dsn>%dsn%</dsn>
|
||||||
|
<user>%username%</user>
|
||||||
|
<password>%password%</password>
|
||||||
|
</connection>
|
||||||
|
</datasource>
|
||||||
|
|
||||||
|
EOT
|
||||||
|
, array(
|
||||||
|
'%name%' => $name,
|
||||||
|
'%adapter%' => $datasource['adapter'],
|
||||||
|
'%dsn%' => $datasource['connection']['dsn'],
|
||||||
|
'%username%' => $datasource['connection']['user'],
|
||||||
|
'%password%' => isset($datasource['connection']['password']) ? $datasource['connection']['password'] : '',
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
$xml .= <<<EOT
|
||||||
|
</datasources>
|
||||||
|
</propel>
|
||||||
|
</config>
|
||||||
|
EOT;
|
||||||
|
|
||||||
|
file_put_contents($file, $xml);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translates a list of connection names to their DSN equivalents.
|
* Translates a list of connection names to their DSN equivalents.
|
||||||
*
|
*
|
||||||
|
@ -278,7 +332,7 @@ abstract class AbstractCommand extends ContainerAwareCommand
|
||||||
$fs = new Filesystem();
|
$fs = new Filesystem();
|
||||||
$buildPropertiesFile = $kernel->getRootDir().'/config/propel.ini';
|
$buildPropertiesFile = $kernel->getRootDir().'/config/propel.ini';
|
||||||
|
|
||||||
if ($fs->exists($buildPropertiesFile)) {
|
if ($fs->exists($file)) {
|
||||||
$fs->copy($buildPropertiesFile, $file);
|
$fs->copy($buildPropertiesFile, $file);
|
||||||
} else {
|
} else {
|
||||||
$fs->touch($file);
|
$fs->touch($file);
|
||||||
|
|
Loading…
Reference in a new issue