hasDefinition(CountNotificationUser::class)) { throw new LogicException('The service ' . CountNotificationUser::class . ' ' . 'should be defined'); } $notificationCounterDefinition = $container->getDefinition(CountNotificationUser::class); foreach ($container->findTaggedServiceIds('chill.count_notification.user') as $id => $tags) { $notificationCounterDefinition ->addMethodCall('addNotificationCounter', [new Reference($id)]); } } }