Skip to content

Commit da1f027

Browse files
committed
combine schema files into one AppData
This fixes propelorm#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.
1 parent 4db28b7 commit da1f027

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

Command/FormGenerateCommand.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,11 @@ protected function configure()
5252
protected function execute(InputInterface $input, OutputInterface $output)
5353
{
5454
if ($schemas = $this->getSchemasFromBundle($this->bundle)) {
55+
$schemas = $this->getFinalSchemas($this->getContainer()->get('kernel'));
56+
57+
$transformer = new \XmlToAppData(null, null, 'UTF-8');
5558
foreach ($schemas as $fileName => $array) {
56-
foreach ($this->getDatabasesFromSchema($array[1]) as $database) {
59+
foreach ($this->getDatabasesFromSchema($array[1], $transformer) as $database) {
5760
$this->createFormTypeFromDatabase($this->bundle, $database, $input->getArgument('models'), $output, $input->getOption('force'));
5861
}
5962
}

Command/GeneratorAwareCommand.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,12 @@ protected function loadPropelGenerator()
3838
set_include_path(sprintf('%s/generator/lib', $propelPath) . PATH_SEPARATOR . get_include_path());
3939
}
4040

41-
protected function getDatabasesFromSchema(\SplFileInfo $file)
41+
protected function getDatabasesFromSchema(\SplFileInfo $file, \XmlToAppData $transformer = null)
4242
{
43-
$transformer = new \XmlToAppData(null, null, 'UTF-8');
43+
if (null === $transformer) {
44+
$transformer = new \XmlToAppData(null, null, 'UTF-8');
45+
}
46+
4447
$config = new \QuickGeneratorConfig();
4548

4649
if (file_exists($propelIni = $this->getContainer()->getParameter('kernel.root_dir') . '/config/propel.ini')) {

0 commit comments

Comments
 (0)