Description
Hi there,
On current master I have an issue were the Default serialization group is not passed on to nested Entities.
It seems to be caused by PR #1367 (more precisely by commit #5e5c650cf8b209da1b46d83c2c451fcd25d741c0).
Here's an example:
App\Entity\Transaction:
exclusion_policy: ALL
xml_root_name: transaction
properties:
id:
expose: true
name:
expose: true
category:
expose: true
buyer:
expose: true
groups: [ 'transaction_full' ]
App\Entity\Category:
exclusion_policy: ALL
xml_root_name: category
properties:
id:
expose: true
name:
expose: true
transactions:
expose: true
groups: [ 'category_full' ]
/**
* Creates a transaction
*
* @SWG\Response(
* response=201,
* description="Transaction created",
* @Model(type=Transaction::class, groups={"Default"})
* )
* @SWG\Tag(name="Transaction")
*/
Result before #1367:
{
"id": 0,
"name": "string",
"category": {
"id": 5,
"name": "Vente d'objets",
}
}
Result after #1367:
{
"id": 0,
"name": "string",
"category": {
"id": 5,
"name": "Vente d'objets",
"transactions": [
{
"id": 0,
"name": "string",
"category": null,
"buyer": { ... }
}
]
}
}
As you can see, the "Default" group is lost in nested Entities, and everything is rendered.
BTW, with stable (3.2.1), I must specify "Default" otherwise everything is shown (not only in nested Entities).
So for me, $groups = null
(#5e5c650cf8b209da1b46d83c2c451fcd25d741c0) is not the same as $groups = [self::DEFAULT_GROUP]
(https://github.com/schmittjoh/serializer/blob/942b566c801b2c567193f006ebf95b027e5bd439/src/JMS/Serializer/Exclusion/GroupsExclusionStrategy.php#L85).
Or maybe I'm missing something?
Thx for your time :)