4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Validator\Context;
14 @trigger_error('The '.__NAMESPACE__.'\LegacyExecutionContextFactory class is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
16 use Symfony\Component\Translation\TranslatorInterface;
17 use Symfony\Component\Validator\MetadataFactoryInterface;
18 use Symfony\Component\Validator\Validator\ValidatorInterface;
21 * Creates new {@link LegacyExecutionContext} instances.
23 * Implemented for backward compatibility with Symfony < 2.5.
25 * @author Bernhard Schussek <bschussek@gmail.com>
27 * @deprecated since version 2.5, to be removed in 3.0.
29 class LegacyExecutionContextFactory implements ExecutionContextFactoryInterface
32 * @var MetadataFactoryInterface
34 private $metadataFactory;
37 * @var TranslatorInterface
44 private $translationDomain;
47 * Creates a new context factory.
49 * @param MetadataFactoryInterface $metadataFactory The metadata factory
50 * @param TranslatorInterface $translator The translator
51 * @param string|null $translationDomain The translation domain
52 * to use for translating
55 public function __construct(MetadataFactoryInterface $metadataFactory, TranslatorInterface $translator, $translationDomain = null)
57 $this->metadataFactory = $metadataFactory;
58 $this->translator = $translator;
59 $this->translationDomain = $translationDomain;
65 public function createContext(ValidatorInterface $validator, $root)
67 return new LegacyExecutionContext(
70 $this->metadataFactory,
72 $this->translationDomain