-
-
Notifications
You must be signed in to change notification settings - Fork 421
Symfony 6.4: make:crud fails with -q: $controllerClassName must not be accessed before initialization #1391
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
Comments
Is it the "-q" that causes this? Does If it does, that's not really the behavior we want. All maker commands are interactive and must be interactive. |
Yes, that's exactly the issue. interact() isn't calls, and that's the only place $this->controllerClassName is set. I have a bundle that wrap console commands in a web interface, which makes debugging much easier (e.g. dumps, dds, and asserts). It collects the arguments and options and then runs the command using zenstruck's excellect console-extra. In fact, I'm trying to use it right now to figure out where to add the widget options in #1392, and is run non-interactively. And for testing I try to put together a bash script that can recreate an issue starting with symfony new... I think bin/console make:crud EntityName -q used to work. All that is to say that I quite like the ability to run all console commands non-interactively. $defaultControllerClass = Str::asClassName(sprintf('%s Controller', $input->getArgument('entity-class')));
$this->controllerClassName = $io->ask(
sprintf('Choose a name for your controller class (e.g. <fg=yellow>%s</>)', $defaultControllerClass),
$defaultControllerClass
); |
There's still an issue with -q for make:crud symfony new test-crud --webapp && cd test-crud
composer config extra.symfony.allow-contrib true
echo "DATABASE_URL=sqlite:///%kernel.project_dir%/var/data.db" > .env.local
composer require orm-fixtures --dev
echo "officialName,string,48,no," | sed "s/,/\n/g" | bin/console make:entity Official
bin/console make:crud Official -q |
I don't think Typically you init a property via the The In maker itself, I'm opposed to adding something like Many *unix commands don't work on windows... Adding Lastly, from experience in maintaining MakerBundle, anytime we've added some of the "niche" features/fixes/etc in the past, (supporting In short, |
Uh oh!
There was an error while loading. Please reload this page.
Using Symfony 6.4, make:crud generates
One problem is that it is missing dependencies, but the error message isn't shown when argument are being passed. But it's curious that webpack doesn't include these.
Secondly, there's no way to do interactive anymore because of the tests question. So it fails on the -q. I can replace that make:crud line with the quirky but functional sed command:
So a working version of the above is this. But -q should work as well.
The text was updated successfully, but these errors were encountered: