Chris@14: Chris@14: * Chris@14: * For the full copyright and license information, please view the LICENSE Chris@14: * file that was distributed with this source code. Chris@14: */ Chris@14: Chris@14: namespace Symfony\Component\DependencyInjection\Compiler; Chris@14: Chris@14: use Symfony\Component\DependencyInjection\Definition; Chris@14: use Symfony\Component\DependencyInjection\Exception\RuntimeException; Chris@14: Chris@14: /** Chris@14: * @author Maxime Steinhausser Chris@14: */ Chris@14: class ResolveFactoryClassPass extends AbstractRecursivePass Chris@14: { Chris@14: /** Chris@14: * {@inheritdoc} Chris@14: */ Chris@14: protected function processValue($value, $isRoot = false) Chris@14: { Chris@17: if ($value instanceof Definition && \is_array($factory = $value->getFactory()) && null === $factory[0]) { Chris@14: if (null === $class = $value->getClass()) { Chris@14: throw new RuntimeException(sprintf('The "%s" service is defined to be created by a factory, but is missing the factory class. Did you forget to define the factory or service class?', $this->currentId)); Chris@14: } Chris@14: Chris@14: $factory[0] = $class; Chris@14: $value->setFactory($factory); Chris@14: } Chris@14: Chris@14: return parent::processValue($value, $isRoot); Chris@14: } Chris@14: }