Revert "[Form] removed a constraint in PropertyPath as the path can definitely be an empty string for errors attached on the main form (when using a constraint defined with the 'validation_constraint' option)"
This reverts commit 5182a0c2c4
.
PropertyPath instances should be empty. If you have an empty property path string, there is no need to create a PropertyPath instance for it.
Conflicts:
tests/Symfony/Tests/Component/Form/PropertyPathTest.php
This commit is contained in:
parent
860dd1f7d8
commit
7ff2a9b210
@ -440,6 +440,14 @@ class PropertyPathTest extends \PHPUnit_Framework_TestCase
|
|||||||
new PropertyPath('property.$form');
|
new PropertyPath('property.$form');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @expectedException Symfony\Component\Form\Exception\InvalidPropertyPathException
|
||||||
|
*/
|
||||||
|
public function testInvalidPropertyPath_empty()
|
||||||
|
{
|
||||||
|
new PropertyPath('');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException Symfony\Component\Form\Exception\InvalidPropertyPathException
|
* @expectedException Symfony\Component\Form\Exception\InvalidPropertyPathException
|
||||||
*/
|
*/
|
||||||
|
@ -77,7 +77,7 @@ class PropertyPath implements \IteratorAggregate
|
|||||||
*/
|
*/
|
||||||
public function __construct($propertyPath)
|
public function __construct($propertyPath)
|
||||||
{
|
{
|
||||||
if (null === $propertyPath) {
|
if ('' === $propertyPath || null === $propertyPath) {
|
||||||
throw new InvalidPropertyPathException('The property path must not be empty');
|
throw new InvalidPropertyPathException('The property path must not be empty');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user