Just a note: You're missing the obligatory extends AbstractController required for $this->createForm()
Personally, I'm not a fan of service locators or static factory methods in the Controller, though I'm willing to bet you can probably typehint the FormBuilder interface if you really want to inject it. That said, not sure about using ->submit(), but I guess that gets around some of the necessary extensions provided when going the default route (ie, the official docs recommend using ->handleRequest() which I don't know is possible without the HttpExtension, and then at that point you probably want to configure that outside of the controller somewhere)
That's my 2 cents. What are you're thoughts?
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Just a note: You're missing the obligatory
extends AbstractController
required for$this->createForm()
Personally, I'm not a fan of service locators or static factory methods in the Controller, though I'm willing to bet you can probably typehint the FormBuilder interface if you really want to inject it. That said, not sure about using
->submit()
, but I guess that gets around some of the necessary extensions provided when going the default route (ie, the official docs recommend using->handleRequest()
which I don't know is possible without the HttpExtension, and then at that point you probably want to configure that outside of the controller somewhere)That's my 2 cents. What are you're thoughts?