From 82890a32dccea1003bdd92af73c44ebbe70d486d Mon Sep 17 00:00:00 2001 From: Francois Zaninotto Date: Wed, 16 Jun 2010 22:34:55 +0200 Subject: [PATCH] [PropelBundle] Fixed sqlmap filenames --- .../PropelBundle/Command/BuildSqlCommand.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Framework/PropelBundle/Command/BuildSqlCommand.php b/src/Symfony/Framework/PropelBundle/Command/BuildSqlCommand.php index 3637a53d43..ded954e09a 100644 --- a/src/Symfony/Framework/PropelBundle/Command/BuildSqlCommand.php +++ b/src/Symfony/Framework/PropelBundle/Command/BuildSqlCommand.php @@ -55,14 +55,17 @@ EOT $this->callPhing('sql', array('propel.packageObjectModel' => false)); $filesystem = new Filesystem(); $basePath = $this->application->getKernel()->getRootDir(). DIRECTORY_SEPARATOR . 'propel'. DIRECTORY_SEPARATOR . 'sql'; + $sqlMap = file_get_contents($basePath . DIRECTORY_SEPARATOR . 'sqldb.map'); foreach ($this->tempSchemas as $schemaFile => $schemaDetails) { $sqlFile = str_replace('.xml', '.sql', $schemaFile); - $targetFileName = $basePath . DIRECTORY_SEPARATOR . $schemaDetails['bundle'] . '-' . str_replace('.xml', '.sql', $schemaDetails['basename']); - $filesystem->remove($targetFileName); - $filesystem->rename($basePath . DIRECTORY_SEPARATOR . $sqlFile, $targetFileName); - $output->writeln(sprintf('Wrote SQL file for bundle "%s" in "%s"', $schemaDetails['bundle'], $targetFileName)); - + $targetSqlFile = $schemaDetails['bundle'] . '-' . str_replace('.xml', '.sql', $schemaDetails['basename']); + $targetSqlFilePath = $basePath . DIRECTORY_SEPARATOR . $targetSqlFile; + $sqlMap = str_replace($sqlFile, $targetSqlFile, $sqlMap); + $filesystem->remove($targetSqlFilePath); + $filesystem->rename($basePath . DIRECTORY_SEPARATOR . $sqlFile, $targetSqlFilePath); + $output->writeln(sprintf('Wrote SQL file for bundle "%s" in "%s"', $schemaDetails['bundle'], $targetSqlFilePath)); } + file_put_contents($basePath . DIRECTORY_SEPARATOR . 'sqldb.map', $sqlMap); } }