diff --git a/src/Maker/MakeRegistrationForm.php b/src/Maker/MakeRegistrationForm.php index e8c66d4cb..501c98ea6 100644 --- a/src/Maker/MakeRegistrationForm.php +++ b/src/Maker/MakeRegistrationForm.php @@ -85,8 +85,8 @@ final class MakeRegistrationForm extends AbstractMaker public function __construct( private FileManager $fileManager, private FormTypeRenderer $formTypeRenderer, - private RouterInterface $router, private DoctrineHelper $doctrineHelper, + private ?RouterInterface $router = null, ) { } @@ -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.'); + } + if (!$this->fileManager->fileExists($path = 'config/packages/security.yaml')) { throw new RuntimeCommandException('The file "config/packages/security.yaml" does not exist. This command needs that file to accurately build your registration form.'); } diff --git a/src/Resources/config/makers.xml b/src/Resources/config/makers.xml index 271bba21a..8ea8f6ba9 100644 --- a/src/Resources/config/makers.xml +++ b/src/Resources/config/makers.xml @@ -77,8 +77,8 @@ - +