|
13 | 13 |
|
14 | 14 | namespace CleverAge\FlysystemProcessBundle\DependencyInjection;
|
15 | 15 |
|
16 |
| -use Sidus\BaseBundle\DependencyInjection\SidusBaseExtension; |
| 16 | +use Symfony\Component\Config\FileLocator; |
| 17 | +use Symfony\Component\DependencyInjection\ContainerBuilder; |
| 18 | +use Symfony\Component\DependencyInjection\Extension\Extension; |
| 19 | +use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; |
| 20 | +use Symfony\Component\Finder\Finder; |
17 | 21 |
|
18 | 22 | /**
|
19 | 23 | * This is the class that loads and manages your bundle configuration.
|
20 | 24 | *
|
21 |
| - * @see http://symfony.com/doc/current/cookbook/bundles/extension.html |
22 |
| - * |
23 |
| - * @author Valentin Clavreul <[email protected]> |
24 |
| - * @author Vincent Chalnot <[email protected]> |
25 |
| - * @author Madeline Veyrenc <[email protected]> |
| 25 | + * @see http://symfony.com/doc/current/cookbook/bundles/extension.html |
26 | 26 | */
|
27 |
| -class CleverAgeFlysystemProcessExtension extends SidusBaseExtension |
| 27 | +class CleverAgeFlysystemProcessExtension extends Extension |
28 | 28 | {
|
| 29 | + public function load(array $configs, ContainerBuilder $container): void |
| 30 | + { |
| 31 | + $this->findServices($container, __DIR__.'/../Resources/config/services'); |
| 32 | + } |
| 33 | + |
| 34 | + /** |
| 35 | + * Recursively import config files into container. |
| 36 | + */ |
| 37 | + protected function findServices(ContainerBuilder $container, string $path, string $extension = 'yaml'): void |
| 38 | + { |
| 39 | + $finder = new Finder(); |
| 40 | + $finder->in($path) |
| 41 | + ->name('*.'.$extension)->files(); |
| 42 | + $loader = new YamlFileLoader($container, new FileLocator($path)); |
| 43 | + foreach ($finder as $file) { |
| 44 | + $loader->load($file->getFilename()); |
| 45 | + } |
| 46 | + } |
29 | 47 | }
|
0 commit comments