Chris@0: Chris@0: * Chris@0: * For the full copyright and license information, please view the LICENSE Chris@0: * file that was distributed with this source code. Chris@0: */ Chris@0: Chris@0: namespace Symfony\Component\Validator\Context; Chris@0: Chris@0: use Symfony\Component\Translation\TranslatorInterface; Chris@0: use Symfony\Component\Validator\Validator\ValidatorInterface; Chris@0: Chris@0: /** Chris@0: * Creates new {@link ExecutionContext} instances. Chris@0: * Chris@0: * @author Bernhard Schussek Chris@0: * Chris@14: * @internal version 2.5. Code against ExecutionContextFactoryInterface instead. Chris@0: */ Chris@0: class ExecutionContextFactory implements ExecutionContextFactoryInterface Chris@0: { Chris@0: private $translator; Chris@0: private $translationDomain; Chris@0: Chris@0: /** Chris@0: * Creates a new context factory. Chris@0: * Chris@0: * @param TranslatorInterface $translator The translator Chris@0: * @param string|null $translationDomain The translation domain to Chris@0: * use for translating Chris@0: * violation messages Chris@0: */ Chris@0: public function __construct(TranslatorInterface $translator, $translationDomain = null) Chris@0: { Chris@0: $this->translator = $translator; Chris@0: $this->translationDomain = $translationDomain; Chris@0: } Chris@0: Chris@0: /** Chris@0: * {@inheritdoc} Chris@0: */ Chris@0: public function createContext(ValidatorInterface $validator, $root) Chris@0: { Chris@0: return new ExecutionContext( Chris@0: $validator, Chris@0: $root, Chris@0: $this->translator, Chris@0: $this->translationDomain Chris@0: ); Chris@0: } Chris@0: }