You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It doesn't, it fails with an exception stating that a boolean was expected but found null.
If you try and use the private or protected property that also fails with access rights issues:
/**
* @Exclude(if="id==null")
*/
You can use the 'object' as a reference to call a getter method which works for serialisation as follows:
/**
* @Exclude(if="object.getName()==null")
*/
But this then fails when de-serialising because the 'object' does not yet exist at decision time. You can overcome it by adding a direction test but this is getting somewhat ridiculous and not at all a nice and straightforward to exclude a property.
| Bug report? | yes
According to the documentation in the exclusion strategies following should work:
http://jmsyst.com/libs/serializer/master/cookbook/exclusion_strategies#dynamic-exclusion-strategy
It doesn't, it fails with an exception stating that a boolean was expected but found null.
If you try and use the private or protected property that also fails with access rights issues:
You can use the 'object' as a reference to call a getter method which works for serialisation as follows:
But this then fails when de-serialising because the 'object' does not yet exist at decision time. You can overcome it by adding a direction test but this is getting somewhat ridiculous and not at all a nice and straightforward to exclude a property.
I'm using jms/serializer-bundle 4.0.2
Symfony 3.4.49 (yes I know, it's currently being upgraded!)
PHP 7.4.27
The text was updated successfully, but these errors were encountered: