Skip to content
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

Open
wants to merge 9 commits into
base: 3.4
Choose a base branch
from
Open

Conversation

jzabrodin
Copy link
Contributor

@jzabrodin jzabrodin commented Dec 28, 2021

Add few details about max_depth and enable_max_depth

@jzabrodin jzabrodin changed the title Patch 2 Update serialization.md Dec 28, 2021
@jzabrodin jzabrodin marked this pull request as ready for review December 28, 2021 11:07
core/serialization.md Outdated Show resolved Hide resolved
core/serialization.md Outdated Show resolved Hide resolved
jzabrodin and others added 2 commits December 28, 2021 13:30
Co-authored-by: Kévin Dunglas <[email protected]>
Co-authored-by: Kévin Dunglas <[email protected]>
@jzabrodin jzabrodin marked this pull request as draft December 28, 2021 11:34
@jzabrodin jzabrodin marked this pull request as ready for review December 28, 2021 11:50
@jzabrodin jzabrodin requested a review from dunglas December 28, 2021 19:14
Copy link
Contributor

@vincentchalamon vincentchalamon left a 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

core/serialization.md Show resolved Hide resolved
core/serialization.md Show resolved Hide resolved
Copy link
Contributor

@vincentchalamon vincentchalamon left a 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]>
@vinceAmstoutz vinceAmstoutz changed the base branch from 2.6 to 3.4 January 14, 2025 10:46
use Symfony\Component\Serializer\Annotation\MaxDepth;

#[ApiResource(
normalizationContext: ['groups' => 'read', 'enable_max_depth' => true],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
normalizationContext: ['groups' => 'read', 'enable_max_depth' => true],
normalizationContext: ['groups' => ['read'], 'enable_max_depth' => true],

#[Groups(["read", "write"])]
public $name;

#[Groups("write")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#[Groups("write")]
#[Groups(["write"])]

Comment on lines +52 to +54
use ApiPlatform\Core\Annotation\ApiResource;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Serializer\Annotation\MaxDepth;
Copy link
Contributor

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:

Suggested change
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;

@vincentchalamon
Copy link
Contributor

I would suggest to target 4.0 branch instead of 3.4, WDYT @vinceAmstoutz @soyuka?

@vinceAmstoutz
Copy link
Contributor

I would suggest to target 4.0 branch instead of 3.4, WDYT @vinceAmstoutz @soyuka?

IMHO 3.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants