diff --git a/Command/SqlBuildCommand.php b/Command/SqlBuildCommand.php index e809cb1..28bdfa7 100644 --- a/Command/SqlBuildCommand.php +++ b/Command/SqlBuildCommand.php @@ -55,24 +55,19 @@ EOT $finder = new Finder(); $filesystem = new Filesystem(); - $sqlDir = $this->getApplication()->getKernel()->getRootDir(). DIRECTORY_SEPARATOR . 'propel'. DIRECTORY_SEPARATOR . 'sql'; - $cacheDir = $this->getApplication()->getKernel()->getCacheDir(). DIRECTORY_SEPARATOR . 'sql'; + $sqlDir = $this->getApplication()->getKernel()->getCacheDir(). DIRECTORY_SEPARATOR .'propel'.DIRECTORY_SEPARATOR. 'sql'; - $filesystem->remove($cacheDir); - $filesystem->mkdir($cacheDir); - - if (!$filesystem->exists($sqlDir)) { - $filesystem->mkdir($sqlDir); - } + $filesystem->remove($sqlDir); + $filesystem->mkdir($sqlDir); // Execute the task $ret = $this->callPhing('build-sql', array( - 'propel.sql.dir' => $cacheDir + 'propel.sql.dir' => $sqlDir )); // Show the list of generated files if (true === $ret) { - $files = $finder->name('*')->in($cacheDir); + $files = $finder->name('*')->in($sqlDir); $nbFiles = 0; foreach ($files as $file) { @@ -81,9 +76,6 @@ EOT if ($fileExt === 'map' && $filesystem->exists($finalLocation)) { $this->mergeMapFiles($finalLocation, (string) $file); - } else { - $filesystem->remove($finalLocation); - $filesystem->rename((string) $file, $finalLocation); } $this->writeNewFile($output, (string) $file); diff --git a/Command/SqlInsertCommand.php b/Command/SqlInsertCommand.php index cdee5d3..2e57ee6 100644 --- a/Command/SqlInsertCommand.php +++ b/Command/SqlInsertCommand.php @@ -52,9 +52,6 @@ EOT */ protected function execute(InputInterface $input, OutputInterface $output) { - // Bad require but needed :( - require_once $this->getContainer()->getParameter('propel.path') . '/generator/lib/util/PropelSqlManager.php'; - if ($input->getOption('force')) { $connections = $this->getConnections(); $sqlDir = $this->getSqlDir(); @@ -80,7 +77,7 @@ EOT protected function getSqlDir() { - return sprintf('%s/propel/sql', $this->getApplication()->getKernel()->getRootDir()); + return sprintf('%s/propel/sql', $this->getApplication()->getKernel()->getCacheDir()); } /**