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:
Bernhard Schussek 2012-05-18 10:53:52 +02:00
parent 860dd1f7d8
commit 7ff2a9b210
2 changed files with 9 additions and 1 deletions

View File

@ -440,6 +440,14 @@ class PropertyPathTest extends \PHPUnit_Framework_TestCase
new PropertyPath('property.$form');
}
/**
* @expectedException Symfony\Component\Form\Exception\InvalidPropertyPathException
*/
public function testInvalidPropertyPath_empty()
{
new PropertyPath('');
}
/**
* @expectedException Symfony\Component\Form\Exception\InvalidPropertyPathException
*/

View File

@ -77,7 +77,7 @@ class PropertyPath implements \IteratorAggregate
*/
public function __construct($propertyPath)
{
if (null === $propertyPath) {
if ('' === $propertyPath || null === $propertyPath) {
throw new InvalidPropertyPathException('The property path must not be empty');
}