Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Serializer] Fix serialization of method with same name than property#62838

Merged
nicolas-grekas merged 1 commit into
symfony:6.4from
VincentLanglet:allowMethodWithSameNameThanProperty
Jan 6, 2026
Merged

[Serializer] Fix serialization of method with same name than property#62838
nicolas-grekas merged 1 commit into
symfony:6.4from
VincentLanglet:allowMethodWithSameNameThanProperty

Conversation

@VincentLanglet
Copy link
Copy Markdown
Contributor

Q A
Branch? 6.4
Bug fix? yes (maybe ?)
New feature? no (not sure ?)
Deprecations? no
Issues Fix #...
License MIT

Currently the DeduplicateStamp has two issues with Symfony Serializer (cf #60659)

  • The Key field is not correctly serialized
  • The property onlyDeduplicateInQueue is not serialized at all

While the first issue is easily solved, the second one does not seems that easy.
Related to discussion #62779 (comment)

The property onlyDeduplicateInQueue is private and the related "getter" is called onlyDeduplicateInQueue() too, which means it's not serialized by the ObjectNormalizer since it only support get/is/can/has methods.
This PR allows

  • to serialized method which has the same name than an object property
  • to add attributes to these methods

I don't know if

If merged in 6.4 this could be used for the fix #62779 (or we use a workaround of having two methods in DeduplicateStamp until 8.1)

cc @nicolas-grekas

Copy link
Copy Markdown
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me as a bug fix.

@VincentLanglet
Copy link
Copy Markdown
Contributor Author

Works for me as a bug fix.

Nice, I'll update #62779 after this merge then

@nicolas-grekas
Copy link
Copy Markdown
Member

Rebase needed after #62886 🙏

@VincentLanglet VincentLanglet force-pushed the allowMethodWithSameNameThanProperty branch from da7e290 to b2cba3c Compare January 2, 2026 19:05
@VincentLanglet
Copy link
Copy Markdown
Contributor Author

Rebase needed after #62886 🙏

Rebased ! I think the failure are unrelated

Copy link
Copy Markdown
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still 👍 on my side

@nicolas-grekas
Copy link
Copy Markdown
Member

Thank you @VincentLanglet.

@nicolas-grekas nicolas-grekas merged commit 0dfca24 into symfony:6.4 Jan 6, 2026
9 of 12 checks passed
nicolas-grekas added a commit that referenced this pull request Jan 6, 2026
…ethods (nicolas-grekas)

This PR was merged into the 6.4 branch.

Discussion
----------

[Serializer] Fix #[Ignore] on same-name properties <-> methods

| Q             | A
| ------------- | ---
| Branch?       | 6.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | -
| License       | MIT

Follows #62838

We should always set the ignore flag when the `#[Ignore]` attribute is present, regardless of the `$accessorOrMutator` or `$hasProperty` flags.

Commits
-------

9895694 [Serializer] Fix #[Ignore] on same-name properties <-> methods
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants