Skip to content

Commit

Permalink
Make bundle autowiring-friendly (#4)
Browse files Browse the repository at this point in the history
* Made bundle autowiring-friendly
  • Loading branch information
Xymanek authored and mark-gerarts committed Jan 23, 2018
1 parent 2873398 commit 6631556
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions DependencyInjection/AutoMapperPlusExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace AutoMapperPlus\AutoMapperPlusBundle\DependencyInjection;

use AutoMapperPlus\AutoMapperPlusBundle\AutoMapperConfiguratorInterface;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\Extension;
Expand All @@ -24,5 +25,8 @@ public function load(array $configs, ContainerBuilder $container)
new FileLocator(__DIR__ . '/../Resources/config')
);
$loader->load('services.yml');

$container->registerForAutoconfiguration(AutoMapperConfiguratorInterface::class)
->addTag('automapper_plus.configurator');
}
}
3 changes: 3 additions & 0 deletions Resources/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ services:
automapper_plus.mapper:
class: AutoMapperPlus\AutoMapper
factory: ['@automapper_plus.mapper_factory', create]

# Add alias so that autowiring works
AutoMapperPlus\AutoMapperInterface: '@automapper_plus.mapper'

0 comments on commit 6631556

Please sign in to comment.