Skip to content

Conversation

@chalasr
Copy link
Member

@chalasr chalasr commented Sep 29, 2025

Q A
Branch? 7.4
Bug fix? no
New feature? no
Deprecations? no
Issues -
License MIT

Reasoning:

  • One may confuse Input with InputInterface implementations
  • The Map convention from controllers is nice, sticking with it makes sense and brings consistency
  • I'm gonna add more, #[MapEntity] on its way

Fabbot's fail is a false positive.

Copy link
Member

@yceruto yceruto left a comment

Choose a reason for hiding this comment

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

I agree primarily for consistency with other controller attributes, and I also agree that its main purpose is mapping raw input values into an object (DTO), so MapInput makes sense to me.

The problem now is that #[Argument] and #[Option] are in a similar situation, aren't they? and it'll feel inconsistent that two closely related concepts follow different naming conventions in the same context. For instance:

function __invoke(#[MapInput] TestDto $dto, #[Option] bool $test = false)

Both naming conventions are valid to me:

  • MapInput focuses on the action/operation around the parameter value,
  • Input (same as Argument & Option) broadly reflects the parameter's role.

Even if the reasons explained are completely valid to me, I think consistency should be tied to the component itself first, then to other components and the framework if possible. That's why I choose Input for this attribute.

@yceruto
Copy link
Member

yceruto commented Sep 29, 2025

Another valid alternative could be moving all these attributes under a namespace that provides context, e.g. Symfony\Component\Console\Input\Mapping as Map. This way, users will have the option to use #[Map\Input] or just #[Input], just like Doctrine ORM does currently #[ORM\Column].

@mtarld
Copy link
Contributor

mtarld commented Sep 30, 2025

To me, attributes prefixed with Map should be about mapping.
Mapping is the process of defining how data from one form or structure corresponds to another. In practice, this means defining how each piece of input data corresponds to a property in an output object.

That's why MapInput makes sense to me here, as it's about mapping the input to an object.

@chalasr
Copy link
Member Author

chalasr commented Sep 30, 2025

@yceruto I understand your POV but share Mathias' opinion. The concept of mapping in the sense of transform/convert is far more present for #[Input], which makes me think it's worth it and I don't feel like it brings inconsistency.

Copy link
Member

@yceruto yceruto left a comment

Choose a reason for hiding this comment

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

I agree with your POV as well, I just wanted to share the other side for consideration.

@nicolas-grekas
Copy link
Member

Thank you @chalasr.

@nicolas-grekas nicolas-grekas merged commit 127d329 into symfony:7.4 Oct 1, 2025
8 of 11 checks passed
@chalasr chalasr deleted the mapinput branch October 1, 2025 14:32
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.

6 participants