KEMBAR78
fix(state): object mapper with input different by soyuka · Pull Request #7435 · api-platform/core · GitHub
Skip to content

Conversation

@soyuka
Copy link
Member

@soyuka soyuka commented Oct 2, 2025

todo: test

@soyuka soyuka merged commit 0b82379 into api-platform:4.2 Oct 3, 2025
112 of 114 checks passed
@soyuka soyuka deleted the fix/input branch October 3, 2025 08:58
@rvanlaak
Copy link
Contributor

rvanlaak commented Oct 9, 2025

Awesome usage example! Might be good to document the test you're doing here as well?

{
$s = new self();
$s->id = $data->id;
$s->username = $data->name;
Copy link
Contributor

@rvanlaak rvanlaak Oct 9, 2025

Choose a reason for hiding this comment

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

This part (writing a value with a name different from it's input name) might only be possible since ObjectMapper's last patch release, and might break pre-7.3.4. Maybe cover this in the composer.json conflicts?


namespace ApiPlatform\Tests\Fixtures\TestBundle\Dto;

class MappedResouceInput
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe also add a test where both these fields are required in the input's constructor, and with coverage on #[Assert\NotBlank] validation?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants