Skip to content

Commit

Permalink
Fix paths based on project_directory
Browse files Browse the repository at this point in the history
  • Loading branch information
mwaterboehr committed Sep 25, 2023
1 parent 00d8a6c commit 0d73dde
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Command/AbstractCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ protected function getPackageFromBundle(Bundle $bundle, $namespace)
$namespaceDiff = substr($namespace, strlen($baseNamespace) + 1);

$bundlePath = realpath($bundle->getPath()) . '/' . str_replace('\\', '/', $namespaceDiff);
$appPath = realpath($this->getKernel()->getProjectDir() . '/..');
$appPath = realpath($this->getKernel()->getProjectDir());

$path = static::getRelativePath($bundlePath, $appPath);

Expand Down
4 changes: 2 additions & 2 deletions Command/FixturesDumpCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ protected function configure()
protected function execute(InputInterface $input, OutputInterface $output)
{
$fixtureDir = $input->getOption('dir') ?: $this->defaultFixturesDir;
$path = realpath($this->getKernel()->getProjectDir() . '/../') . '/' . $fixtureDir;
$path = realpath($this->getKernel()->getProjectDir() . '/') . '/' . $fixtureDir;

if (!file_exists($path)) {
$output->writeln("<info>The $path folder does not exists.</info>");
$output->writeln("<info>The $path folder does not exist.</info>");
if ($this->askConfirmation($input, $output, "<question>Do you want me to create it for you ?</question> [Yes]")) {
$fs = new Filesystem();
$fs->mkdir($path);
Expand Down
2 changes: 1 addition & 1 deletion Command/FixturesLoadCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
if (null !== $this->bundle) {
$this->absoluteFixturesPath = $this->getFixturesPath($this->bundle);
} else {
$this->absoluteFixturesPath = realpath($this->getKernel()->getProjectDir() . '/../' . $input->getOption('dir'));
$this->absoluteFixturesPath = realpath($this->getKernel()->getProjectDir() . '/' . $input->getOption('dir'));
}

if (!$this->absoluteFixturesPath && !file_exists($this->absoluteFixturesPath)) {
Expand Down
2 changes: 1 addition & 1 deletion Command/FormGenerateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ protected function writeFormType(BundleInterface $bundle, Table $table, \SplFile
*/
protected function getRelativeFileName(\SplFileInfo $file)
{
return substr(str_replace(realpath($this->getContainer()->getParameter('kernel.project_dir') . '/../'), '', $file), 1);
return substr(str_replace(realpath($this->getContainer()->getParameter('kernel.project_dir') . '/'), '', $file), 1);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Command/ModelBuildCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ protected function createSubCommandInstance()
*/
protected function getSubCommandArguments(InputInterface $input)
{
$outputDirDefault = $this->getApplication()->getKernel()->getProjectDir().'/../';
$outputDirDefault = $this->getApplication()->getKernel()->getProjectDir().'/';
$outputDir = $this->input->getOption('output-dir') ?: $outputDirDefault;

$result = [
Expand Down
2 changes: 1 addition & 1 deletion Tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function getContainer()
{
$container = new ContainerBuilder(new ParameterBag(array(
'kernel.debug' => false,
'kernel.project_dir' => __DIR__ . '/../',
'kernel.project_dir' => __DIR__ . '/',
)));

$container->setParameter('propel.configuration', array());
Expand Down

0 comments on commit 0d73dde

Please sign in to comment.