combine schema files into one AppData
This fixes #173. In case the schema.xml files are referenced across multiple bundles, the \AppData needs to be extended by each bundle, before reading data from the respective \Database.
This commit is contained in:
parent
4db28b7bbd
commit
da1f027142
|
@ -52,8 +52,11 @@ EOT
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
if ($schemas = $this->getSchemasFromBundle($this->bundle)) {
|
if ($schemas = $this->getSchemasFromBundle($this->bundle)) {
|
||||||
|
$schemas = $this->getFinalSchemas($this->getContainer()->get('kernel'));
|
||||||
|
|
||||||
|
$transformer = new \XmlToAppData(null, null, 'UTF-8');
|
||||||
foreach ($schemas as $fileName => $array) {
|
foreach ($schemas as $fileName => $array) {
|
||||||
foreach ($this->getDatabasesFromSchema($array[1]) as $database) {
|
foreach ($this->getDatabasesFromSchema($array[1], $transformer) as $database) {
|
||||||
$this->createFormTypeFromDatabase($this->bundle, $database, $input->getArgument('models'), $output, $input->getOption('force'));
|
$this->createFormTypeFromDatabase($this->bundle, $database, $input->getArgument('models'), $output, $input->getOption('force'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,9 +38,12 @@ abstract class GeneratorAwareCommand extends AbstractCommand
|
||||||
set_include_path(sprintf('%s/generator/lib', $propelPath) . PATH_SEPARATOR . get_include_path());
|
set_include_path(sprintf('%s/generator/lib', $propelPath) . PATH_SEPARATOR . get_include_path());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getDatabasesFromSchema(\SplFileInfo $file)
|
protected function getDatabasesFromSchema(\SplFileInfo $file, \XmlToAppData $transformer = null)
|
||||||
{
|
{
|
||||||
$transformer = new \XmlToAppData(null, null, 'UTF-8');
|
if (null === $transformer) {
|
||||||
|
$transformer = new \XmlToAppData(null, null, 'UTF-8');
|
||||||
|
}
|
||||||
|
|
||||||
$config = new \QuickGeneratorConfig();
|
$config = new \QuickGeneratorConfig();
|
||||||
|
|
||||||
if (file_exists($propelIni = $this->getContainer()->getParameter('kernel.root_dir') . '/config/propel.ini')) {
|
if (file_exists($propelIni = $this->getContainer()->getParameter('kernel.root_dir') . '/config/propel.ini')) {
|
||||||
|
|
Loading…
Reference in a new issue