Skip to content
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

[Serializer] regression with attribute serialization #54983

Open
bendavies opened this issue May 17, 2024 · 2 comments
Open

[Serializer] regression with attribute serialization #54983

bendavies opened this issue May 17, 2024 · 2 comments

Comments

@bendavies
Copy link
Contributor

bendavies commented May 17, 2024

Symfony version(s) affected

6.4.7

Description

There appears to be a regression in v6.4.7 with serializing "nested" attributes with a property path.

How to reproduce

Given a serialization config like:

App\Entity\Foo:
  attributes:
    bar.id:
      serialized_name: bar_id
      groups: ['read']

where Bar is a relation on Foo, bar_id is not serialized in in v6.4.7, but was in v6.4.6.

Possible Solution

No response

Additional Context

#52917 seems suspect to me.

@HypeMC
Copy link
Contributor

HypeMC commented May 21, 2024

Yep, this was introduced in #52917, before the changes the ObjectNormalizer would access the property using the property access component:

protected function getAttributeValue(object $object, string $attribute, ?string $format = null, array $context = []): mixed
{
$mapping = $this->classDiscriminatorResolver?->getMappingForMappedObject($object);
return $attribute === $mapping?->getTypeProperty()
? $mapping
: $this->propertyAccessor->getValue($object, $attribute);
}

But now the isAllowedAttribute() method filters out bar.id, so it never reaches that code.

cc @mtarld

@mxr576
Copy link

mxr576 commented May 24, 2024

Probably we are experiencing the same issue on apigee/apigee-client-php as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants