diff --git a/Module.php b/Module.php index acd3fcc..30f860c 100644 --- a/Module.php +++ b/Module.php @@ -2,6 +2,6 @@ /** * This file is placed here for compatibility with Zendframework 2's ModuleManager. * It allows usage of this module even without composer. - * The original Module.php is in 'src/DoctrineORMModule' in order to respect PSR-0 + * The original Module.php is in 'src/DoctrineDataFixtureModule' in order to respect PSR-0 */ -require_once __DIR__ . '/src/DoctrineDataFixtureModule/Module.php'; \ No newline at end of file +require_once __DIR__ . '/src/DoctrineDataFixtureModule/Module.php'; diff --git a/src/DoctrineDataFixtureModule/Command/ImportCommand.php b/src/DoctrineDataFixtureModule/Command/ImportCommand.php index f944eda..829c377 100644 --- a/src/DoctrineDataFixtureModule/Command/ImportCommand.php +++ b/src/DoctrineDataFixtureModule/Command/ImportCommand.php @@ -19,17 +19,17 @@ namespace DoctrineDataFixtureModule\Command; -use Symfony\Component\Console\Command\Command, - Symfony\Component\Console\Input\InputInterface, - Symfony\Component\Console\Output\OutputInterface, - Symfony\Component\Console\Input\InputArgument, - Symfony\Component\Console\Input\InputOption, - Doctrine\ORM\Tools\SchemaTool, - Doctrine\DBAL\Migrations\Configuration\Configuration; - +use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputOption; +use Doctrine\ORM\Tools\SchemaTool; +use Doctrine\DBAL\Migrations\Configuration\Configuration; use Doctrine\Common\DataFixtures\Loader; use Doctrine\Common\DataFixtures\Executor\ORMExecutor; use Doctrine\Common\DataFixtures\Purger\ORMPurger; + /** * Command for generate migration classes by comparing your current database schema * to your mapping information. @@ -53,7 +53,8 @@ protected function configure() $this->setName('data-fixture:import') ->setDescription('Import Data Fixtures') - ->setHelp(<<setHelp( +<<getOption('purge-with-truncate')) { + if ($input->getOption('purge-with-truncate')) { $purger->setPurgeMode(self::PURGE_MODE_TRUNCATE); } $executor = new ORMExecutor($this->em, $purger); - foreach($this->paths as $key => $value) { + foreach ($this->paths as $key => $value) { $loader->loadFromDirectory($value); } $executor->execute($loader->getFixtures(), $input->getOption('append')); } - public function setPath($paths) + public function setPath($paths) { $this->paths=$paths; } diff --git a/src/DoctrineDataFixtureModule/Module.php b/src/DoctrineDataFixtureModule/Module.php index 13bfca4..dceb0a8 100644 --- a/src/DoctrineDataFixtureModule/Module.php +++ b/src/DoctrineDataFixtureModule/Module.php @@ -62,7 +62,7 @@ public function init(ModuleManager $e) $events = $e->getEventManager()->getSharedManager(); // Attach to helper set event and load the entity manager helper. - $events->attach('doctrine', 'loadCli.post', function(EventInterface $e) { + $events->attach('doctrine', 'loadCli.post', function (EventInterface $e) { /* @var $cli \Symfony\Component\Console\Application */ $cli = $e->getTarget(); diff --git a/src/DoctrineDataFixtureModule/Service/FixtureFactory.php b/src/DoctrineDataFixtureModule/Service/FixtureFactory.php index 17a7eb4..ee74528 100644 --- a/src/DoctrineDataFixtureModule/Service/FixtureFactory.php +++ b/src/DoctrineDataFixtureModule/Service/FixtureFactory.php @@ -52,7 +52,7 @@ public function createService(ServiceLocatorInterface $sl) public function getOptions(ServiceLocatorInterface $sl, $key) { $options = $sl->get('Configuration'); - if(!isset($options['data-fixture'])) { + if (!isset($options['data-fixture'])) { return array(); } @@ -61,6 +61,6 @@ public function getOptions(ServiceLocatorInterface $sl, $key) public function getOptionsClass() { - return 'DoctrineDataFixtureModule\Options\Fixture'; + return 'DoctrineDataFixtureModule\Options\Fixture'; } } diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php index 3ad8797..066d35b 100644 --- a/tests/Bootstrap.php +++ b/tests/Bootstrap.php @@ -19,4 +19,4 @@ /* @var $loader \Composer\Autoload\ClassLoader */ $loader->add('DoctrineDataFixtureTest\\', __DIR__); -unset($files, $file, $loader); \ No newline at end of file +unset($files, $file, $loader);