diff --git a/Command/FixturesDumpCommand.php b/Command/FixturesDumpCommand.php index abaa037..360677e 100644 --- a/Command/FixturesDumpCommand.php +++ b/Command/FixturesDumpCommand.php @@ -62,7 +62,18 @@ EOT list($name, $defaultConfig) = $this->getConnection($input, $output); $fixtureDir = $input->getOption('dir') ? $input->getOption('dir') : $this->defaultFixturesDir; - $path = realpath($this->getApplication()->getKernel()->getRootDir() . '/../') . '/' . $fixtureDir; + $path = realpath($this->getApplication()->getKernel()->getRootDir() . '/../') . '/' . $fixtureDir; + + if (!file_exists($path)) { + $output->writeln("The $path folder does not exists."); + if ($this->askConfirmation($output, "Do you want me to create it for you ? [Yes]")) { + $fs = new Filesystem(); + $fs->mkdir($path); + } else { + throw new \IOException(sprintf('Unable to find the %s folder', $path)); + } + } + $filename = $path . '/fixtures_' . time() . '.yml'; $dumper = new YamlDataDumper($this->getApplication()->getKernel()->getRootDir());