merged branch bschussek/propertypath (PR #5011)

Commits
-------

dd2aa54 [Form] Disabled manual singulars in PropertyPath until the syntax is finalized

Discussion
----------

[Form] Disabled manual singulars in PropertyPath until the syntax is finalized

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -
This commit is contained in:
Fabien Potencier 2012-07-22 10:03:04 +02:00
commit c20c1d18dc
3 changed files with 11 additions and 2 deletions

View File

@ -211,6 +211,8 @@ abstract class PropertyPathCollectionTest extends \PHPUnit_Framework_TestCase
public function testSetValueCallsCustomAdderAndRemover()
{
$this->markTestSkipped('This feature is temporarily disabled as of 2.1');
$car = $this->getMock(__CLASS__ . '_CarCustomSingular');
$axesBefore = $this->getCollection(array(1 => 'second', 3 => 'fourth'));
$axesAfter = $this->getCollection(array(0 => 'first', 1 => 'second', 2 => 'third'));
@ -300,6 +302,9 @@ abstract class PropertyPathCollectionTest extends \PHPUnit_Framework_TestCase
);
$data[] = array($car, $propertyPath, $expectedMessage);
/*
Temporarily disabled in 2.1
$propertyPath = new PropertyPath('axes|boo');
$expectedMessage = sprintf(
'Neither element "axes" nor method "setAxes()" exists in class '
@ -309,6 +314,7 @@ abstract class PropertyPathCollectionTest extends \PHPUnit_Framework_TestCase
'boo'
);
$data[] = array($car, $propertyPath, $expectedMessage);
*/
$car = $this->getMock(__CLASS__ . '_CarNoAdderAndRemoverWithProperty');
$propertyPath = new PropertyPath('axes');

View File

@ -95,6 +95,8 @@ class PropertyPathTest extends \PHPUnit_Framework_TestCase
public function testGetValueIgnoresSingular()
{
$this->markTestSkipped('This feature is temporarily disabled as of 2.1');
$object = (object) array('children' => 'Many');
$path = new PropertyPath('children|child');

View File

@ -118,8 +118,9 @@ class PropertyPath implements \IteratorAggregate, PropertyPathInterface
$element = $matches[3];
$this->isIndex[] = true;
}
$pos = strpos($element, self::SINGULAR_SEPARATOR);
// Disabled this behaviour as the syntax is not yet final
//$pos = strpos($element, self::SINGULAR_SEPARATOR);
$pos = false;
$singular = null;
if (false !== $pos) {