mirror of
https://github.com/Respect/Validation.git
synced 2024-06-27 17:50:13 +02:00
Fixed nested messaging for grouped exceptions.
This commit is contained in:
parent
00b4c24c19
commit
cb6a14e02e
|
@ -44,12 +44,14 @@ class AbstractGroupedException extends AbstractNestedException
|
|||
|
||||
public function getTemplate()
|
||||
{
|
||||
if (!empty($this->template))
|
||||
$parentTemplate = parent::getTemplate();
|
||||
|
||||
if (!empty($this->template) && $this->template != $parentTemplate)
|
||||
return $this->template;
|
||||
if (1 === count($this->related))
|
||||
return current($this->related)->getTemplate();
|
||||
else
|
||||
return parent::getTemplate();
|
||||
return $parentTemplate;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -39,6 +39,16 @@ class ArrTest extends \PHPUnit_Framework_TestCase
|
|||
array(array(1, 2, 3)),
|
||||
array(new \ArrayObject),
|
||||
);
|
||||
|
||||
|
||||
|
||||
$validator = v::alnum()->length(1,10);
|
||||
|
||||
$validator = new \Respect\Validation\Rules\AllOf(
|
||||
new Respect\Validation\Rules\Alnum(),
|
||||
new Respect\Validation\Rules\Length(1,10)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function providerForNotArray()
|
||||
|
|
Loading…
Reference in a new issue