Skip to content

Commit 82890a3

Browse files
fzaninottofabpot
authored andcommitted
[PropelBundle] Fixed sqlmap filenames
1 parent a71a75a commit 82890a3

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/Symfony/Framework/PropelBundle/Command/BuildSqlCommand.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,17 @@ protected function execute(InputInterface $input, OutputInterface $output)
5555
$this->callPhing('sql', array('propel.packageObjectModel' => false));
5656
$filesystem = new Filesystem();
5757
$basePath = $this->application->getKernel()->getRootDir(). DIRECTORY_SEPARATOR . 'propel'. DIRECTORY_SEPARATOR . 'sql';
58+
$sqlMap = file_get_contents($basePath . DIRECTORY_SEPARATOR . 'sqldb.map');
5859
foreach ($this->tempSchemas as $schemaFile => $schemaDetails) {
5960
$sqlFile = str_replace('.xml', '.sql', $schemaFile);
60-
$targetFileName = $basePath . DIRECTORY_SEPARATOR . $schemaDetails['bundle'] . '-' . str_replace('.xml', '.sql', $schemaDetails['basename']);
61-
$filesystem->remove($targetFileName);
62-
$filesystem->rename($basePath . DIRECTORY_SEPARATOR . $sqlFile, $targetFileName);
63-
$output->writeln(sprintf('Wrote SQL file for bundle "<info>%s</info>" in "<info>%s</info>"', $schemaDetails['bundle'], $targetFileName));
64-
61+
$targetSqlFile = $schemaDetails['bundle'] . '-' . str_replace('.xml', '.sql', $schemaDetails['basename']);
62+
$targetSqlFilePath = $basePath . DIRECTORY_SEPARATOR . $targetSqlFile;
63+
$sqlMap = str_replace($sqlFile, $targetSqlFile, $sqlMap);
64+
$filesystem->remove($targetSqlFilePath);
65+
$filesystem->rename($basePath . DIRECTORY_SEPARATOR . $sqlFile, $targetSqlFilePath);
66+
$output->writeln(sprintf('Wrote SQL file for bundle "<info>%s</info>" in "<info>%s</info>"', $schemaDetails['bundle'], $targetSqlFilePath));
6567
}
68+
file_put_contents($basePath . DIRECTORY_SEPARATOR . 'sqldb.map', $sqlMap);
6669
}
6770

6871
}

0 commit comments

Comments
 (0)