Skip to content

[Serializer] add can to the accessor prefixes recognized by the AttributeLoader #61023

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

Open
wants to merge 1 commit into
base: 7.4
Choose a base branch
from

Conversation

themasch
Copy link
Contributor

@themasch themasch commented Jul 2, 2025

Q A
Branch? 7.4
Bug fix? yes
New feature? no
Deprecations? no
Issues Fix #61021
License MIT

The ObjectNormalizer already recognizes canX as an accessor and "generates" a property for that, the AttributeLoader does not, so #[Ignore] attributes on canX are ignored, the return value is encoded in the normalized data.

We just add the can prefix ot the list of accepted accessor prefixes, so the AttributeLoader now also recognized these.

I adapted a test that seemd to me to fit the best. If you'd prefer a dedicated test for that, I can do that, too.

…he AttributeLoader

The ObjectNormalizer already recognizes `canX` as an accessor and "generates" a property for that, the AttributeLoader does not, so #[Ignore] attributes on `canX` are ignored, the return value is encoded in the normalized data.

We just add the `can` prefix ot the list of accepted accessor prefixes, so the AttributeLoader now also recognized these.
@carsonbot

This comment has been minimized.

@carsonbot carsonbot added this to the 7.4 milestone Jul 2, 2025
@carsonbot carsonbot changed the title bug #61021: add can to the accessor prefixes recognized by the AttributeLoader [Serializer] bug #61021: add can to the accessor prefixes recognized by the AttributeLoader Jul 2, 2025
@OskarStark OskarStark changed the title [Serializer] bug #61021: add can to the accessor prefixes recognized by the AttributeLoader [Serializer] add can to the accessor prefixes recognized by the AttributeLoader Jul 2, 2025
Comment on lines +32 to +36
#[Ignore]
public function getSomethingElse(): int
{
return 42;
}
Copy link
Member

Choose a reason for hiding this comment

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

This additional test case seems not related to your PR topic. Is there a use for it that I've missed?

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.

[Serializer] ObjectNormalizer recognizes canX as getter, but Attribute loader does not
4 participants