-
-
Notifications
You must be signed in to change notification settings - Fork 404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[make:registration] Make router optional in MakeRegistrationForm constructor #1227
Conversation
@@ -111,6 +111,10 @@ public function interact(InputInterface $input, ConsoleStyle $io, Command $comma | |||
{ | |||
$interactiveSecurityHelper = new InteractiveSecurityHelper(); | |||
|
|||
if (null === $this->router) { | |||
throw new RuntimeCommandException('Router have been explicitely disabled in your configuration. This command needs to use the router.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Help welcome to choose a clearer message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good enough to me - especially for this edge-case
Ah, so you can't run maker at all in your console app? That makes sense - I don't normally think about the router service not being available, but that seems legal to me. |
private DoctrineHelper $doctrineHelper, | ||
private ?RouterInterface $router = null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Class is internal, so no problems changing args 👍
@@ -111,6 +111,10 @@ public function interact(InputInterface $input, ConsoleStyle $io, Command $comma | |||
{ | |||
$interactiveSecurityHelper = new InteractiveSecurityHelper(); | |||
|
|||
if (null === $this->router) { | |||
throw new RuntimeCommandException('Router have been explicitely disabled in your configuration. This command needs to use the router.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good enough to me - especially for this edge-case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @odolbeau
In a console application, I have the following configuration:
As the
MakeRegistrationForm
class need aRouterInterface
to be constructed, I get the following error:Symfony\Bundle\MakerBundle\Maker\MakeRegistrationForm::__construct(): Argument #3 ($router) must be of type Symfony\Component\Routing\RouterInterface, null given
This PR aim to remove this dependency.