schmittjoh / JMSSerializerBundle

Easily serialize, and deserialize data of any complexity (supports XML, JSON, YAML)
http://jmsyst.com/bundles/JMSSerializerBundle
MIT License
1.8k stars 311 forks source link

@Serializer\Exclude() broken since 3.5 #797

Open thedomeffm opened 4 years ago

thedomeffm commented 4 years ago

With version "jms/serializer-bundle": "^3.5",

the short form of @Exclude (in annotations?) does not work fine:

    /**
     * @var Client
     *
     * @Serializer\Exclude()
     *
     * @ORM\ManyToOne(targetEntity="Client")
     * @ORM\JoinColumn(name="client_id", referencedColumnName="id")
     */

But this works:

    /**
     * @var Client
     *
     * @Serializer\Exclude(if="true")
     [...]
thedomeffm commented 4 years ago

Info: In normal properties like $createdAt it is working fine. It has something to do with the reference.

goetas commented 4 years ago

can you please tell which version of jms/serializer and jms/metadata are you using?

goetas commented 4 years ago

this is weird to me as the version that supports @Exclude(if="something") has not yet been released

thedomeffm commented 4 years ago

composer.json

"jms/serializer-bundle": "^3.5",

composer.lock

[...]
{
    "name": "jms/metadata",
    "version": "2.1.0",
},
{
    "name": "jms/serializer",
    "version": "3.6.0",
},
{
    "name": "jms/serializer-bundle",
     "version": "3.5.0",
}
[...]
goetas commented 4 years ago

I've tried to reproduce this without success, can you try to submit a failing test case?

praditha-hidayat commented 2 years ago

I have another test case here: https://github.com/schmittjoh/JMSSerializerBundle/issues/889 Maybe it's the same issue.