-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Update serialization.md #1490
base: 3.4
Are you sure you want to change the base?
Update serialization.md #1490
Conversation
Add enable_max_depth details
Co-authored-by: Kévin Dunglas <[email protected]>
Co-authored-by: Kévin Dunglas <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also provide an XML example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comment from Dunglas to fix, then 👍
Co-authored-by: Kévin Dunglas <[email protected]>
use Symfony\Component\Serializer\Annotation\MaxDepth; | ||
|
||
#[ApiResource( | ||
normalizationContext: ['groups' => 'read', 'enable_max_depth' => true], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
normalizationContext: ['groups' => 'read', 'enable_max_depth' => true], | |
normalizationContext: ['groups' => ['read'], 'enable_max_depth' => true], |
#[Groups(["read", "write"])] | ||
public $name; | ||
|
||
#[Groups("write")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#[Groups("write")] | |
#[Groups(["write"])] |
use ApiPlatform\Core\Annotation\ApiResource; | ||
use Symfony\Component\Serializer\Annotation\Groups; | ||
use Symfony\Component\Serializer\Annotation\MaxDepth; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend to target 4.0 branch instead of 3.4, and update the imports as following:
use ApiPlatform\Core\Annotation\ApiResource; | |
use Symfony\Component\Serializer\Annotation\Groups; | |
use Symfony\Component\Serializer\Annotation\MaxDepth; | |
use ApiPlatform\Metadata\ApiResource; | |
use Symfony\Component\Serializer\Attribute\Groups; | |
use Symfony\Component\Serializer\Attribute\MaxDepth; |
I would suggest to target 4.0 branch instead of 3.4, WDYT @vinceAmstoutz @soyuka? |
IMHO |
Add few details about max_depth and enable_max_depth