Skip to content

Commit

Permalink
[PropelBundle] Fixed sqlmap filenames
Browse files Browse the repository at this point in the history
  • Loading branch information
fzaninotto authored and fabpot committed Jun 23, 2010
1 parent a71a75a commit 82890a3
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/Symfony/Framework/PropelBundle/Command/BuildSqlCommand.php
Expand Up @@ -55,14 +55,17 @@ protected function execute(InputInterface $input, OutputInterface $output)
$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 "<info>%s</info>" in "<info>%s</info>"', $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 "<info>%s</info>" in "<info>%s</info>"', $schemaDetails['bundle'], $targetSqlFilePath));
}
file_put_contents($basePath . DIRECTORY_SEPARATOR . 'sqldb.map', $sqlMap);
}

}

0 comments on commit 82890a3

Please sign in to comment.