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] Save missing arguments in MissingConstructorArgumentsException#42712

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

Merged
fabpot merged 1 commit intosymfony:5.4fromBafS:patch-2
Sep 21, 2021

Conversation

BafS
Copy link
Contributor

@BafSBafS commentedAug 24, 2021
edited
Loading

QA
Branch?5.4
Bug fix?no
New feature?not really
Deprecations?no
TicketsFix #...
LicenseMIT
Doc PRsymfony/symfony-docs#...

It's currently not possible to get the information about which constructor argument is missing (except by doing regex in the exception message string). Having this information is useful when we want to have an input transformer without the need to set every fields to nullable.

For example with this flow:[request payload] -> [normalizer/unserializer] -> [dto] -> [validation], each field must be nullable to not have exception during the normalization and then we still need to validate, instead we could catchMissingConstructorArgumentsException, handle it and make a nice http exception.

Edit: related to#42502

@BafSBafS requested a review fromdunglas as acode ownerAugust 24, 2021 17:09
@carsonbotcarsonbot added this to the6.0 milestoneAug 24, 2021
@carsonbotcarsonbot changed the title[serializer] Save missing arguments in MissingConstructorArgumentsException[Serializer] Save missing arguments in MissingConstructorArgumentsExceptionAug 24, 2021
@nicolas-grekas
Copy link
Member

That'd be for 5.4 yes. Can you please retarget?

BafS reacted with thumbs up emoji

@nicolas-grekasnicolas-grekas modified the milestones:6.0,5.4Sep 7, 2021
@BafSBafS changed the base branch from6.0 to5.4September 7, 2021 14:04
@BafSBafS changed the base branch from5.4 to6.0September 7, 2021 14:05
@BafSBafS changed the base branch from6.0 to5.4September 7, 2021 14:25
Copy link
Member

@fabpotfabpot left a comment

Choose a reason for hiding this comment

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

Looks good to me, can you rebase on current 5.4?
Can you also add a note in the CHANGELOG of the component?

BafS reacted with thumbs up emoji
@BafS
Copy link
ContributorAuthor

Thanks. Rebased + readme updated, let me know if it's ok

@fabpot
Copy link
Member

Thank you@BafS.

BafS reacted with thumbs up emoji

@fabpotfabpot merged commit6ef5661 intosymfony:5.4Sep 21, 2021
This was referencedNov 5, 2021
nicolas-grekas added a commit that referenced this pull requestFeb 23, 2023
…ception class with MissingConstructorArgumentException (HypeMC)This PR was merged into the 6.3 branch.Discussion----------[Serializer] Replace the MissingConstructorArgumentsException class with MissingConstructorArgumentException| Q             | A| ------------- | ---| Branch?       | 6.3| Bug fix?      | no| New feature?  | yes| Deprecations? | yes| Tickets       | -| License       | MIT| Doc PR        | -Followup to#42712.Currently only the missing arguments are saved in the `MissingConstructorArgumentsException`, so there's no way of knowing which class is missing those arguments when nested objects are being deserialized. This PR adds this information to the exception.Also, while working on this I've noticed that the `$missingArguments` argument accepts an array of missing arguments, but only one is ever passed. I'm not sure if this was done intentionally or by accident, but I've changed it so that only one is expected. Please let me know if this change is ok.UPDATE:I've added a new `MissingConstructorArgumentException` class which accepts only one argument and the class name and deprecated the `MissingConstructorArgumentsException` class. However, since the main goal of this PR is to add the class to the exception, I can revert the renaming part if you think the change is not worth it.Commits-------b377c12 [Serializer] Replace the MissingConstructorArgumentsException class with MissingConstructorArgumentException
nicolas-grekas added a commit that referenced this pull requestApr 21, 2023
…rning missing argument one by one (ktherage)This PR was squashed before being merged into the 6.3 branch.Discussion----------[Serializer] Fix MissingConstructorArgumentsException returning missing argument one by one| Q             | A| ------------- | ---| Branch?       | 6.3| Bug fix?      | yes| New feature?  | no| Deprecations? | no| Tickets       | -| License       | MIT| Doc PR        | -This PR is an improvment of#49013 andfix#42712.She aims to fix the problem reported in#49013 indicating that the method `getMissingConstructorArguments()` of `\Symfony\Component\Serializer\Exception\MissingConstructorArgumentsException` class introduced in#42712 is returning only one missing arguments when there's more than one missing.Commits-------43d028d [Serializer] Fix MissingConstructorArgumentsException returning missing argument one by one
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@fabpotfabpotfabpot approved these changes

@dunglasdunglasAwaiting requested review from dunglasdunglas is a code owner

@chalasrchalasrAwaiting requested review from chalasr

@jderussejderusseAwaiting requested review from jderusse

@lyrixxlyrixxAwaiting requested review from lyrixx

@OskarStarkOskarStarkAwaiting requested review from OskarStark

@srozesrozeAwaiting requested review from sroze

@wouterjwouterjAwaiting requested review from wouterj

@xabbuhxabbuhAwaiting requested review from xabbuh

@ycerutoycerutoAwaiting requested review from yceruto

Assignees
No one assigned
Projects
None yet
Milestone
5.4
Development

Successfully merging this pull request may close these issues.

4 participants
@BafS@nicolas-grekas@fabpot@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp