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

[ObjectMapper] added earlier skip to allow if=false when using source mapping#60491

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
nicolas-grekas merged 1 commit intosymfony:7.3frommaciekpaprocki:7.3
May 20, 2025

Conversation

maciekpaprocki
Copy link
Contributor

@maciekpaprockimaciekpaprocki commentedMay 20, 2025
edited
Loading

QA
Branch?7.3
Bug fix?yes
New feature?no
Deprecations?no
LicenseMIT

Currently when using object mapper from source if seems to fail if the oiginal source class doesn't have this field.

Which means

class A {public$id =1}class B {  #[Map(source:'id')]public$id = null#[Map(if:false)]  public$additionalInfo = null}$objectMapper->map(newA(),newB());

will fail because there's no property available in A.

Moving the if statement up in the object mapper solves the issue if #Map(if: false). It doesn't support full "IF" logic as it's dependent on value, but I think that's all right. Don't really see why someone would need that if there's no mapping value either way.

@maciekpaprocki
Copy link
ContributorAuthor

Hey!

Thanks for your PR. You are targeting branch "7.3" but it seems your PR description refers to branch "7.3 bug fix". Could you update the PR description or change target branch? This helps core maintainers a lot.

Cheers!

Carsonbot

Sorry bot, misspelling :)

also, for whover is reviewing. I didn't add changelog as i think object mapper for now on is in preview. Please let me know if you would like me to add that.

@carsonbotcarsonbot changed the titleadded earlier skip to allow if=false when using source mapping[ObjectMapper] added earlier skip to allow if=false when using source mappingMay 20, 2025
@symfonysymfony deleted a comment fromcarsonbotMay 20, 2025
@symfonysymfony deleted a comment fromcarsonbotMay 20, 2025
@soyuka
Copy link
Contributor

@maciekpaprocki thanks I agree with the patch, changelog is not needed as its for features only if I'm not mistaken.

@nicolas-grekas
Copy link
Member

Thank you@maciekpaprocki.

maciekpaprocki reacted with hooray emoji

@nicolas-grekasnicolas-grekas merged commitd4fd462 intosymfony:7.3May 20, 2025
11 checks passed
@fabpotfabpot mentioned this pull requestMay 25, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@soyukasoyukasoyuka approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
7.3
Development

Successfully merging this pull request may close these issues.

5 participants
@maciekpaprocki@soyuka@nicolas-grekas@xabbuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp