Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Serializer] add UidNormalizer#36406

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed

Conversation

@guillbdx
Copy link

QA
Branch?master
Bug fix?no
New feature?yes
Deprecations?no
Tickets#36102
LicenseMIT

UUID and ULID normalizer.

dunglas and andreybolonin reacted with thumbs up emojimaxhelias and andreybolonin reacted with heart emoji
@nicolas-grekasnicolas-grekas changed the title[Serializer][FWB] UidNormalizer.[Serializer] add UidNormalizerApr 10, 2020
@guillbdxguillbdxforce-pushed theserializer-uid-normalizer branch from3e2abfb to74235abCompareMay 5, 2020 19:15
@guillbdxguillbdxforce-pushed theserializer-uid-normalizer branch from5ff8932 toabe7069CompareMay 5, 2020 19:25
* Made`BrowserKitAssertionsTrait` report the original error message in case of a failure
* Added ability for`config:dump-reference` and`debug:config` to dump and debug kernel container extension configuration.
* Deprecated`session.attribute_bag` service and`session.flash_bag` service.
* Added`UidNormalizer` to the framework serializer.
Copy link
Member

Choose a reason for hiding this comment

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

Can be removed

<serviceid="serializer.normalizer.uid"class="Symfony\Component\Serializer\Normalizer\UidNormalizer">
<!-- Run before serializer.normalizer.object-->
<tagname="serializer.normalizer"priority="-880" />
</service>
Copy link
Member

Choose a reason for hiding this comment

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

Should be moved to the new PHP config file.
For the priority, I would use -915 to be consistent with the other very specialized normalizers.

* added support for`\stdClass` to`ObjectNormalizer`
* added the ability to ignore properties using metadata (e.g.`@Symfony\Component\Serializer\Annotation\Ignore`)
* added an option to serialize constraint violations payloads (e.g. severity)
* added`UidNormalizer`
Copy link
Member

Choose a reason for hiding this comment

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

Should be moved to the 5.2.0 section.

*/
publicfunctionnormalize($object,string$format =null,array$context = [])
{
if (!$objectinstanceof AbstractUid) {
Copy link
Member

Choose a reason for hiding this comment

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

The condition can be removed as the supports method garuantees that already.

/**
* {@inheritdoc}
*
* @throws InvalidArgumentException
Copy link
Member

Choose a reason for hiding this comment

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

Can be removed

/**
* {@inheritdoc}
*
* @throws NotNormalizableValueException
Copy link
Member

Choose a reason for hiding this comment

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

Can be removed

*/
publicfunctiondenormalize($data,string$type,string$format =null,array$context = [])
{
if (!class_exists(AbstractUid::class)) {
Copy link
Member

Choose a reason for hiding this comment

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

Can be removed

try {
$uid = Ulid::class ===$type ? Ulid::fromString($data) : Uuid::fromString($data);
}catch (\InvalidArgumentException$exception) {
thrownewNotNormalizableValueException('The data is not a valid'.$type.' string representation.');
Copy link
Member

Choose a reason for hiding this comment

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

You should use sprintf here.

@fabpot
Copy link
Member

@guillbdx Can you have a look at the feedback?

@fabpot
Copy link
Member

Anyone willing to take over this PR?

@fabpot
Copy link
Member

Closing in favor of#38151

@fabpotfabpot closed thisSep 11, 2020
fabpot added a commit that referenced this pull requestSep 11, 2020
This PR was merged into the 5.2-dev branch.Discussion----------[Serializer] add UidNormalizer| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| Deprecations? | no| Tickets       |#36102| License       | MIT| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->UUID and ULID normalizer.Continuation of#36406Commits-------d6a8993 Update based on feedback1c21c78 UidNormalizer.
@nicolas-grekasnicolas-grekas modified the milestones:next,5.2Oct 5, 2020
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@dunglasdunglasdunglas requested changes

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

@fabpotfabpotfabpot requested changes

Assignees

No one assigned

Projects

None yet

Milestone

5.2

Development

Successfully merging this pull request may close these issues.

5 participants

@guillbdx@fabpot@dunglas@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp