8000 merged branch acasademont/camelize_property_path_add_and_remove_metho… · jeremymarc/symfony@f7d2ad2 · GitHub
[go: up one dir, main page]

Skip to content

Commit f7d2ad2

Browse files
committed
merged branch acasademont/camelize_property_path_add_and_remove_methods (PR symfony#4673)
Commits ------- 9fabb3d [Form] Camelize 'add' and 'remove' methods in the PropertyPath Discussion ---------- [Form] Camelize 'add' and 'remove' methods in the PropertyPath Bug fix: yes Feature addition: no Backwards compatibility break: yes Symfony2 tests pass: [![Build Status](https://secure.travis-ci.org/acasademont/symfony.png?branch=camelize_property_path_add_and_remove_methods)](http://travis-ci.org/acasademont/symfony) Fixes the following tickets: - License of the code: MIT Documentation PR: - This issue camelizes the 'add' and 'remove' methods, as it is already done with the 'set' method. This fixes a problem with properties like 'custom_messages', where the 'add' and 'remove' methods are 'addCustom_message' and 'removeCustom_message' instead of 'addCustomMessage' and 'removeCustomMessage'. --------------------------------------------------------------------------- by acasademont at 2012-06-27T18:16:36Z Seems the tests are failing due to some unrelated test in PHP 5.3.14 and PHP 5.4. PHP 5.3.3 works fine --------------------------------------------------------------------------- by travisbot at 2012-06-27T18:38:39Z This pull request [fails](http://travis-ci.org/symfony/symfony/builds/1722847) (merged 9fabb3d into d0e1547).
2 parents 16f15e9 + 9fabb3d commit f7d2ad2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Symfony/Component/Form/Util/PropertyPath.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -535,8 +535,8 @@ protected function camelize($string)
535535
private function findAdderAndRemover(\ReflectionClass $reflClass, $singular)
536536
{
537537
if (null !== $singular) {
538-
$addMethod = 'add' . ucfirst($singular);
539-
$removeMethod = 'remove' . ucfirst($singular);
538+
$addMethod = 'add' . $this->camelize($singular);
539+
$removeMethod = 'remove' . $this->camelize($singular);
540540

541541
if (!$this->isAccessible($reflClass, $addMethod, 1)) {
542542
throw new InvalidPropertyException(sprintf(
@@ -558,7 +558,7 @@ private function findAdderAndRemover(\ReflectionClass $reflClass, $singular)
558558
}
559559

560560
// The plural form is the last element of the property path
561-
$plural = ucfirst($this->elements[$this->length - 1]);
561+
$plural = $this->camelize($this->elements[$this->length - 1]);
562562

563563
// Any of the two methods is required, but not yet known
564564
$singulars = (array) FormUtil::singularify($plural);

0 commit comments

Comments
 (0)
0