2010-06-24 09:40:05 +01:00
|
|
|
<?php
|
|
|
|
|
2010-10-02 11:42:31 +01:00
|
|
|
/*
|
2011-01-15 13:29:43 +00:00
|
|
|
* This file is part of the Symfony package.
|
2010-10-02 11:42:31 +01:00
|
|
|
*
|
2011-03-06 11:40:06 +00:00
|
|
|
* (c) Fabien Potencier <fabien@symfony.com>
|
2010-10-02 11:42:31 +01:00
|
|
|
*
|
2011-01-15 13:29:43 +00:00
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
2010-10-02 11:42:31 +01:00
|
|
|
*/
|
|
|
|
|
2011-01-15 13:29:43 +00:00
|
|
|
namespace Symfony\Component\Validator;
|
|
|
|
|
2010-06-24 09:40:05 +01:00
|
|
|
abstract class ConstraintValidator implements ConstraintValidatorInterface
|
|
|
|
{
|
2011-05-17 22:04:13 +01:00
|
|
|
/**
|
|
|
|
* @var ExecutionContext
|
|
|
|
*/
|
2010-06-24 10:24:08 +01:00
|
|
|
protected $context;
|
2011-05-17 22:04:13 +01:00
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
2010-06-24 10:24:08 +01:00
|
|
|
private $messageTemplate;
|
2011-05-17 22:04:13 +01:00
|
|
|
/**
|
|
|
|
* @var array
|
|
|
|
*/
|
2010-06-24 10:24:08 +01:00
|
|
|
private $messageParameters;
|
2010-06-24 09:40:05 +01:00
|
|
|
|
2011-01-16 04:41:23 +00:00
|
|
|
/**
|
|
|
|
* {@inheritDoc}
|
|
|
|
*/
|
2011-01-19 14:02:00 +00:00
|
|
|
public function initialize(ExecutionContext $context)
|
2010-06-24 10:24:08 +01:00
|
|
|
{
|
|
|
|
$this->context = $context;
|
|
|
|
$this->messageTemplate = '';
|
|
|
|
$this->messageParameters = array();
|
|
|
|
}
|
2010-06-24 09:40:05 +01:00
|
|
|
|
2011-01-16 04:41:23 +00:00
|
|
|
/**
|
|
|
|
* {@inheritDoc}
|
|
|
|
*/
|
2010-06-24 10:24:08 +01:00
|
|
|
public function getMessageTemplate()
|
|
|
|
{
|
|
|
|
return $this->messageTemplate;
|
|
|
|
}
|
2010-06-24 09:40:05 +01:00
|
|
|
|
2011-01-16 04:41:23 +00:00
|
|
|
/**
|
|
|
|
* {@inheritDoc}
|
|
|
|
*/
|
2010-06-24 10:24:08 +01:00
|
|
|
public function getMessageParameters()
|
|
|
|
{
|
|
|
|
return $this->messageParameters;
|
|
|
|
}
|
2010-06-24 09:40:05 +01:00
|
|
|
|
2010-06-24 10:24:08 +01:00
|
|
|
protected function setMessage($template, array $parameters = array())
|
|
|
|
{
|
|
|
|
$this->messageTemplate = $template;
|
|
|
|
$this->messageParameters = $parameters;
|
|
|
|
}
|
2010-06-24 09:40:05 +01:00
|
|
|
}
|