Skip to content

Simplify the form submission #27638

@ismail1432

Description

@ismail1432

Description
At the moment when you want to submit a form in a controller most of the time you should call 3 methods handleRequest($request) , isSubmitted() and isValid() see documentation and if you call isValid() without calling isSubmitted() before it will throw an Exception

I know it's little magic but the simple idea is to aggregate the 3 methods in 1.
the method will handle the request, check if the form isSubmitted and if it's valid.

Example

public function add(Request $request)
{
//create $form
//do some stuff
if($form->isCorrect($request)) {
// Do some stuff with $form
}

The method name is a simple example. I'am ready to work on if you're OK
I think the community have already spoken about that, but I'm not sure, WDYT ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    DXDX = Developer eXperience (anything that improves the experience of using Symfony)FeatureForm

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions