phpsymfonyautowiredsymfony4

Is it possible to exclude multiple directories when using Symfony autowire?


When using autowire in Symfony 4 I used this working code:

App\:
    resource: '../src/*'
    exclude: '../src/{Domain,Entity,Migrations,Tests}'

That code excludes from the autowiring all this folders:

- src/Domain
- src/Entity
- src/Migrations
- src/Tests

That is ok, but the problem comes when I want to exclude multiple folders with the same name that are dispersed inside another folders.

For example if we have this structure:

¿Is there some way to exclude all folders with name FolderToExclude?

I already tried the following code with some small variations:

App\:
    resource: '../src/*'
    exclude: '../src/{Domain,Entity,Migrations,Tests,**/FolderToExclude}'

But it does not work :(


Solution

  • In Symfony 4.1. But there is an closed bug and a pull request that may make this feature available for symfony 4.2 !