Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added ignoreDirectories option to the configuration #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,17 @@ autoDI:
- %appDir%/../vendor
```

You can ignore directories, like this:
```yaml
autoDI:
directories:
- %appDir%
- %appDir%/../vendor
ignoreDirectories:
- exludedDir
- anotherExludedDir
```

## Register services on configuration

Compiler extensions such as AutoDIExtension manipulates the DI container
Expand Down
5 changes: 5 additions & 0 deletions src/AutoDI/DI/AutoDIExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class AutoDIExtension extends CompilerExtension
'directories' => [
'%appDir%',
],
'ignoreDirectories' => [],
'defaults' => [],
'tempDir' => '%tempDir%',
];
Expand Down Expand Up @@ -55,6 +56,10 @@ private function registerServices(): void
$robotLoader->addDirectory($directory);
}

foreach ($config['ignoreDirectories'] as $ignoredDirectory) {
$robotLoader->ignoreDirs = $robotLoader->ignoreDirs . ',' . $ignoredDirectory;
}

$robotLoader->setTempDirectory($config['tempDir']);
$robotLoader->rebuild();

Expand Down