Skip to content

Commit

Permalink
remove deprecated tags from configuration (#703)
Browse files Browse the repository at this point in the history
  • Loading branch information
BaHeK1994 authored Jun 11, 2021
1 parent eeb94ce commit a11cd18
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion config/paginator.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<argument key="defaultPageRange">%knp_paginator.page_range%</argument>
<argument key="defaultPageLimit">%knp_paginator.page_limit%</argument>
</argument>
<tag name="knp_paginator.subscriber" />
<tag name="kernel.event_subscriber" />
<tag name="kernel.event_listener" event="kernel.request" method="onKernelRequest" />
</service>

Expand Down
13 changes: 9 additions & 4 deletions src/DependencyInjection/Compiler/PaginatorConfigurationPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,20 @@ public function process(ContainerBuilder $container): void
return;
}

foreach ($container->findTaggedServiceIds('knp_paginator.listener') as $serviceId => $tags) {
$listeners = $container->findTaggedServiceIds('knp_paginator.listener');
$subscribers = $container->findTaggedServiceIds('knp_paginator.subscriber');

foreach ($listeners as $serviceId => $tags) {
@\trigger_error('Using "knp_paginator.listener" tag is deprecated, use "kernel.event_listener" instead.', \E_USER_DEPRECATED);
}

foreach ($container->findTaggedServiceIds('knp_paginator.subscriber') as $serviceId => $tags) {
foreach ($subscribers as $serviceId => $tags) {
@\trigger_error('Using "knp_paginator.subscriber" tag is deprecated, use "kernel.event_subscriber" instead.', \E_USER_DEPRECATED);
}

$pass = new RegisterListenersPass('event_dispatcher', 'knp_paginator.listener', 'knp_paginator.subscriber');
$pass->process($container);
if (\count($listeners) > 0 || \count($subscribers) > 0) {
$pass = new RegisterListenersPass('event_dispatcher', 'knp_paginator.listener', 'knp_paginator.subscriber');
$pass->process($container);
}
}
}

0 comments on commit a11cd18

Please sign in to comment.