DoctrineFixturesExtension.php 949 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. declare(strict_types=1);
  3. namespace Doctrine\Bundle\FixturesBundle\DependencyInjection;
  4. use Doctrine\Bundle\FixturesBundle\DependencyInjection\CompilerPass\FixturesCompilerPass;
  5. use Doctrine\Bundle\FixturesBundle\ORMFixtureInterface;
  6. use Symfony\Component\Config\FileLocator;
  7. use Symfony\Component\DependencyInjection\ContainerBuilder;
  8. use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
  9. use Symfony\Component\HttpKernel\DependencyInjection\Extension;
  10. use function dirname;
  11. class DoctrineFixturesExtension extends Extension
  12. {
  13. /**
  14. * {@inheritdoc}
  15. */
  16. public function load(array $configs, ContainerBuilder $container)
  17. {
  18. $loader = new XmlFileLoader($container, new FileLocator(dirname(__DIR__) . '/Resources/config'));
  19. $loader->load('services.xml');
  20. $container->registerForAutoconfiguration(ORMFixtureInterface::class)
  21. ->addTag(FixturesCompilerPass::FIXTURE_TAG);
  22. }
  23. }