Skip to content

Conversation

@simonschaufi
Copy link
Collaborator

No description provided.

@simonschaufi simonschaufi requested a review from linawolf October 6, 2025 19:14
@simonschaufi
Copy link
Collaborator Author

I'm not sure how the other commands are validated like MiddlewareCommand

@linawolf
Copy link
Collaborator

linawolf commented Oct 7, 2025

I think that validators should be attached to the models / information objects and not to the commands. I made a large PR where I introduced attributes that was rejected be @froemken so I would like him to review what direction we want to take this.

@linawolf linawolf requested a review from froemken October 7, 2025 05:07
@linawolf
Copy link
Collaborator

linawolf commented Oct 7, 2025

See #96

@froemken
Copy link
Collaborator

Symfony Commands deliver a possibility to validate, normalize and auto-complete questions. As some questions should have auto-complete, some other questions use normalizer and validate or both or all three options I have created a solution called InputHandlers. It will group all assigned input handlers into there specific group (validation, normalize, auto-complete) and starts iterating through each class of each group. So, you can define 3 or 5 validators for just one question, 2 normalizers and the command will automatically outputs validation messages or the normalized value. So, no need to extend the command class itself with your own validator. Please use the original symfony validator possibilities I provide with Input Handlers.

But yes, this system is not fully integrated until now. Have a look into $this->askForTypeConverterClassName($io) of TypeConverterCommand. That should NOT be the way to ask questions anymore. It needs a TypeConverterQuestion object now, where ClassNameValidator is assigned to as Input Handler.

Further ALL questions are currently collected in QuestionCollector. That's also NOT the final path. Each Command should get it's OWN QuestionCollector with JUST the questions valid for THIS specific command.

Maybe I get time to get that finalized at weekend. I would wait with merging your patch. That's definitely something which we need in kickstarter. Thank you for your support. Do you want to update this patch afterward yourself, or should I overwrite your patch?

Stefan

@simonschaufi
Copy link
Collaborator Author

Do you want to update this patch afterward yourself, or should I overwrite your patch?

I don't care. Whatever is better for you.

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.

4 participants