diff --git a/src/DMS/Bundle/FilterBundle/DependencyInjection/DMSFilterExtension.php b/src/DMS/Bundle/FilterBundle/DependencyInjection/DMSFilterExtension.php index 0964908..b8d8e32 100644 --- a/src/DMS/Bundle/FilterBundle/DependencyInjection/DMSFilterExtension.php +++ b/src/DMS/Bundle/FilterBundle/DependencyInjection/DMSFilterExtension.php @@ -27,7 +27,5 @@ public function load(array $configs, ContainerBuilder $container): void $loader->load('services.yml'); $container->setParameter('dms_filter.auto_filter_forms', $config['auto_filter_forms']); - - AnnotationRegistry::registerAutoloadNamespace('DMS\Bundle\FilterBundle\Rule', __DIR__ . '/../../../'); } } diff --git a/src/DMS/Bundle/FilterBundle/Resources/config/services.yml b/src/DMS/Bundle/FilterBundle/Resources/config/services.yml index 45aa00b..4cd8990 100644 --- a/src/DMS/Bundle/FilterBundle/Resources/config/services.yml +++ b/src/DMS/Bundle/FilterBundle/Resources/config/services.yml @@ -4,24 +4,21 @@ parameters: dms.filter.inner.filter.class: DMS\Filter\Filter services: - - dms.filter: - class: DMS\Bundle\FilterBundle\Service\Filter + # Class service. + DMS\Bundle\FilterBundle\Service\Filter: public: true arguments: - '@dms.filter.inner.filter' - dms.filter.type_extension: - class: DMS\Bundle\FilterBundle\Form\Type\FormTypeFilterExtension + DMS\Bundle\FilterBundle\Form\Type\FormTypeFilterExtension: public: true arguments: - - '@dms.filter' + - '@DMS\Bundle\FilterBundle\Service\Filter' - '%dms_filter.auto_filter_forms%' tags: - { name: form.type_extension, alias: Symfony\Component\Form\Extension\Core\Type\FormType, extended_type: Symfony\Component\Form\Extension\Core\Type\FormType } - dms.filter.container_loader: - class: DMS\Bundle\FilterBundle\Loader\ContainerAwareLoader + DMS\Bundle\FilterBundle\Loader\ContainerAwareLoader: calls: - [ setContainer, ['@service_container'] ] @@ -40,10 +37,9 @@ services: class: '%dms.filter.inner.filter.class%' arguments: - '@dms.filter.mapping.factory' - - '@dms.filter.container_loader' + - '@DMS\Bundle\FilterBundle\Loader\ContainerAwareLoader' - dms.filter.container_filter: - class: DMS\Bundle\FilterBundle\Filter\ContainerFilter + DMS\Bundle\FilterBundle\Filter\ContainerFilter: public: true calls: - [setContainer, ['@service_container']] diff --git a/src/DMS/Bundle/FilterBundle/Rule/Service.php b/src/DMS/Bundle/FilterBundle/Rule/Service.php index 2e61cba..270f611 100644 --- a/src/DMS/Bundle/FilterBundle/Rule/Service.php +++ b/src/DMS/Bundle/FilterBundle/Rule/Service.php @@ -2,6 +2,7 @@ namespace DMS\Bundle\FilterBundle\Rule; +use DMS\Bundle\FilterBundle\Filter\ContainerFilter; use DMS\Filter\Rules\Rule; /** @@ -36,6 +37,6 @@ public function getRequiredOptions(): array */ public function getFilter(): string { - return 'dms.filter.container_filter'; + return ContainerFilter::class; } } diff --git a/src/DMS/Bundle/FilterBundle/Tests/Integration/ContainerTest.php b/src/DMS/Bundle/FilterBundle/Tests/Integration/ContainerTest.php index 70f70c2..fc4f4c2 100644 --- a/src/DMS/Bundle/FilterBundle/Tests/Integration/ContainerTest.php +++ b/src/DMS/Bundle/FilterBundle/Tests/Integration/ContainerTest.php @@ -3,6 +3,7 @@ namespace DMS\DMS\Bundle\FilterBundle\Tests\Integration; use DMS\Bundle\FilterBundle\DependencyInjection\DMSFilterExtension; +use DMS\Bundle\FilterBundle\Service\Filter; use Doctrine\Common\Annotations\AnnotationReader; use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -33,7 +34,7 @@ public function buildContainer() public function testContainerBoots() { - $this->container->get('dms.filter'); + $this->container->get(Filter::class); if (method_exists($this->container, 'isCompiled')) { self::assertTrue($this->container->isCompiled());