Skip to content

Commit

Permalink
Fix group in command line integration with doctrina loadCli
Browse files Browse the repository at this point in the history
  • Loading branch information
grassato committed Dec 24, 2016
1 parent aedaa97 commit bad4188
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Installation
To install is quite simple, add the **composer.json:**

```
"diegograssato/doctrine-odm-datafixture": "dev-master"
"diegograssato/doctrine-odm-datafixture": "1.*"
```

Next step is to update the composer
Expand All @@ -27,9 +27,9 @@ Then add **DoctrineMongoODMDatafixture** to your **config/application.config.php
In **module.config.php** you should inform the folder where your fixtures, for example:

```
'odm-data-fixtures' => array(
'odm-data-fixtures' => [
__NAMESPACE__.'_fixtures' => __DIR__.'/../src/Fixtures',
),
]
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ protected function findFixtureInApplication()

protected function isGroupSupport()
{

if(count($this->fixturesConfig) === 0) {
return false;
}
Expand Down Expand Up @@ -169,7 +170,9 @@ protected function getPathFromConig(InputInterface $input, OutputInterface $outp
$this->paths = $this->fixturesConfig;
$output->writeln(sprintf('<comment>%s</comment>', "Loading path from configuration file."));

}elseif (empty($this->paths)) {
}

if (empty($this->paths)) {

$output->writeln(sprintf('<comment>%s</comment>', "Detecting fixture in application."));
$this->paths = $this->findFixtureInApplication();
Expand Down
10 changes: 7 additions & 3 deletions src/DoctrineMongoODMDatafixture/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class Module
{
const VERSION = '1.0';
const VERSION = '1.2';

public function getConfig()
{
Expand All @@ -36,9 +36,12 @@ public function init(ModuleManagerInterface $manager)
*/
public function loadCli(EventInterface $event)
{
$config = $event->getParam('ServiceManager')->get('config');
$fixturesConfig = (isset($config['odm-data-fixtures']))? $config['odm-data-fixtures'] : null;

$commands = array(
new \DoctrineMongoODMDatafixture\Command\DoctrineMongoODMDatafixtureCommand(),
new \DoctrineMongoODMDatafixture\Command\DoctrineMongoODMDatafixtureListCommand()
new \DoctrineMongoODMDatafixture\Command\DoctrineMongoODMDatafixtureCommand($fixturesConfig),
new \DoctrineMongoODMDatafixture\Command\DoctrineMongoODMDatafixtureListCommand($fixturesConfig)
);

foreach ($commands as $command) {
Expand All @@ -64,4 +67,5 @@ public function loadCli(EventInterface $event)
$cli->getHelperSet()->set($documentHelper, 'dm');
$cli->getHelperSet()->set(new QuestionHelper(), 'question');
}

}

0 comments on commit bad4188

Please sign in to comment.