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

[Serializer] All fields are not included by default, but upon adding any attribute, all fields are then required #52673

Copy link
Copy link
Closed
@nesl247

Description

@nesl247
Issue body actions

Symfony version(s) affected

6.3.8

Description

According to https://symfony.com/doc/current/components/serializer.html#ignoring-attributes all properties are included by default, which makes sense. However, this doesn't seem to be the case at least for traits and abstract classes.

When we don't add the #[Ignore] attribute in the TestTrait in the reproducer, everything works fine. However, adding that attribute causes all of the other properties to now be seen by the serializer and then fail because there is no public access to them via getters or via public properties.

How to reproduce

https://github.com/nesl247/symfony-serialization-ignore-bug

  1. git clone https://github.com/nesl247/symfony-serialization-ignore-bug.git
  2. composer install
  3. bin/console test:command

Possible Solution

No response

Additional Context


In PropertyAccessor.php line 456:
                                                                                    
  Can't get a way to read the property "testProperty2" in class "App\TestMessage".  
                                                                                    

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

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