'knp_paginator']; foreach ($container->findTaggedServiceIds(self::PAGINATOR_AWARE_TAG) as $id => [$attributes]) { $definition = $container->getDefinition($id); if (null === $class = $definition->getClass()) { throw new \InvalidArgumentException(\sprintf('Service "%s" not found.', $id)); } /** @var class-string $class */ $refClass = new \ReflectionClass($class); if (!$refClass->implementsInterface(self::PAGINATOR_AWARE_INTERFACE)) { throw new \InvalidArgumentException(\sprintf('Service "%s" must implement interface "%s".', $id, self::PAGINATOR_AWARE_INTERFACE)); } $attributes = \array_merge($defaultAttributes, $attributes); if (!$container->has($attributes['paginator'])) { throw new InvalidDefinitionException(\sprintf('Paginator service "%s" for tag "%s" on service "%s" could not be found.', $attributes['paginator'], self::PAGINATOR_AWARE_TAG, $id)); } $definition->addMethodCall('setPaginator', [new Reference($attributes['paginator'])]); $container->setDefinition($id, $definition); } } }