-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[Serializer] By default the serializer do not convert to lower case properties #7626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@lyrixx thanks for fixing this error! I added a small example to show that the conversion doesn't change the lower/uppercase of the method name.
@javiereguiluz Thanks but actually it a bit more complex than that. The ObjectNormalizer use the property name for the name, but use the getter to get the value. class Post
{
private $publishedAt;
public function getPublishedAt()
{
return $this->publishedAt;
}
} it will be serialized to |
@lyrixx OK. Then I don't understand this phrase:
By the way, I can understand your comment perfectly ... so maybe that's the description we should use. |
Indeed, I don't understand the comment either... |
May be we could explain how to add this name converter in the SE: serializer:
enabled: true
name_converter: serializer.name_converter.camel_case_to_snake_case |
ping @dunglas :) |
ping @dunglas |
Should we close here? We have no more feedback or information about what to do 😞 |
No, you can merge as it |
components/serializer.rst
Outdated
@@ -512,7 +512,7 @@ There are several types of normalizers available: | |||
calling the constructor during the denormalization process. | |||
|
|||
Objects are normalized to a map of property names (method name stripped of | |||
the "get"/"set"/"has"/"remove" prefix and converted to lower case) to property |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the first letter is lower cased (getFoo -> foo), my sentence was unclear, indeed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So may I suggest: "Objects are normalized to a map of property names (method name stripped of the "get"/"set"/"has"/"remove" prefix and first letter converted to lower case) ..."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍, it's "obvious" that the conversion will occur
Thanks Grégoire and Kévin! Merged on 2.7 branch. |
…lower case properties (lyrixx, javiereguiluz) This PR was submitted for the 2.8 branch but it was merged into the 2.7 branch instead (closes #7626). Discussion ---------- [Serializer] By default the serializer do not convert to lower case properties Commits ------- 16cad92 Minor reword b384cc2 [Serializer] Added missing ObjectNormalizer f7ebf56 [Serializer] By default the serializer do not convert to lower case properties
No description provided.