Skip to content

Commit

Permalink
merged branch bschussek/issue5388 (PR #5778)
Browse files Browse the repository at this point in the history
This PR was merged into the 2.1 branch.

Commits
-------

bda29b3 [Form] Fixed error message in PropertyPath to not advice to use a non-existing feature

Discussion
----------

[Form] Fixed error message in PropertyPath to not advice to use a non-existing feature

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: #5388
Todo: -
License of the code: MIT
Documentation PR: -
  • Loading branch information
fabpot committed Oct 18, 2012
2 parents 9006294 + 55492f1 commit 0a9b136
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
13 changes: 8 additions & 5 deletions Tests/Util/PropertyPathCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,10 @@ public function noAdderRemoverData()
$expectedMessage = sprintf(
'Neither element "axes" nor method "setAxes()" exists in class '
.'"%s", nor could adders and removers be found based on the '
.'guessed singulars: %s (provide a singular by suffixing the '
.'property path with "|{singular}" to override the guesser)',
.'guessed singulars: %s'
// . '(provide a singular by suffixing the '
// .'property path with "|{singular}" to override the guesser)'
,
get_class($car),
implode(', ', (array) $singulars = FormUtil::singularify('Axes'))
);
Expand All @@ -324,9 +326,10 @@ public function noAdderRemoverData()
$propertyPath = new PropertyPath('axes');
$expectedMessage = sprintf(
'Property "axes" is not public in class "%s", nor could adders and '
.'removers be found based on the guessed singulars: %s '
.'(provide a singular by suffixing the property path with '
.'"|{singular}" to override the guesser). Maybe you should '
.'removers be found based on the guessed singulars: %s'
// .' (provide a singular by suffixing the property path with '
// .'"|{singular}" to override the guesser)'
. '. Maybe you should '
.'create the method "setAxes()"?',
get_class($car),
implode(', ', (array) $singulars = FormUtil::singularify('Axes'))
Expand Down
3 changes: 2 additions & 1 deletion Util/PropertyPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,8 @@ private function writeProperty(&$objectOrArray, $property, $singular, $isIndex,
} else {
$adderRemoverError = ', nor could adders and removers be found based on the ';
if (null === $singular) {
$adderRemoverError .= 'guessed singulars: '.implode(', ', $singulars).' (provide a singular by suffixing the property path with "|{singular}" to override the guesser)';
// $adderRemoverError .= 'guessed singulars: '.implode(', ', $singulars).' (provide a singular by suffixing the property path with "|{singular}" to override the guesser)';
$adderRemoverError .= 'guessed singulars: '.implode(', ', $singulars);
} else {
$adderRemoverError .= 'passed singular: '.$singular;
}
Expand Down

0 comments on commit 0a9b136

Please sign in to comment.