Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b344af7

Browse filesBrowse files
committed
[Serializer] Drop support for jQuery style methods
1 parent f8cda04 commit b344af7
Copy full SHA for b344af7

File tree

Expand file treeCollapse file tree

2 files changed

+9
-7
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+9
-7
lines changed

‎src/Symfony/Component/Serializer/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Component/Serializer/CHANGELOG.md
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
CHANGELOG
22
=========
33

4+
2.7.0
5+
-----
6+
7+
* added `ObjectNormalizer` leveraging the `PropertyAccess` component to normalize
8+
objects containing both properties and getters / setters / issers / hassers methods.
9+
410
2.6.0
511
-----
612

‎src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php
+3-7Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,25 +69,21 @@ public function normalize($object, $format = null, array $context = array())
6969
!$reflMethod->isDestructor() &&
7070
0 === $reflMethod->getNumberOfRequiredParameters()
7171
) {
72-
// getsetters (jQuery style, e.g. read: last(), write: last($item))
7372
$name = $reflMethod->getName();
7473

7574
if (strpos($name, 'get') === 0 || strpos($name, 'has') === 0) {
7675
// getters and hassers
77-
$name = lcfirst(substr($name, 3));
76+
$attributes[lcfirst(substr($name, 3))] = true;
7877
} elseif (strpos($name, 'is') === 0) {
7978
// issers
80-
$name = lcfirst(substr($name, 2));
79+
$attributes[lcfirst(substr($name, 2))] = true;
8180
}
82-
83-
$attributes[$name] = true;
8481
}
8582
}
8683

8784
// properties
8885
foreach ($reflClass->getProperties(\ReflectionProperty::IS_PUBLIC) as $reflProperty) {
89-
$name = $reflProperty->getName();
90-
$attributes[$name] = true;
86+
$attributes[$reflProperty->getName()] = true;
9187
}
9288

9389
$attributes = array_keys($attributes);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.