Skip to content
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

allow path and route name options in make:controller #1378

Open
tacman opened this issue Oct 20, 2023 · 0 comments
Open

allow path and route name options in make:controller #1378

tacman opened this issue Oct 20, 2023 · 0 comments

Comments

@tacman
Copy link
Contributor

tacman commented Oct 20, 2023

Description

When recreating a small application in order to demonstrate a specific issue, I typically do something like this:

symfony new --webapp show-some-feature && cd show-some-feature
bin/console make:controller App 
sed -i "s|/app|/|" src/Controller/AppController.php 
sed -i "s|app_app|app_homepage|" src/Controller/AppController.php 
# composer req my-bundles, etc. and create whatever to show off some bundle or bug
symfony server:start -d
symfony open:local

This allows me to set the route name and path, in this case, to app_homepage and /.

Now that invokable controllers are available in the maker bundle 6.4, it seems even more natural to want to specify and a route and path. (And template, but I don't want to ask for too much!).

Example

So I'd like to get rid of the sed calls above and do something like this:

bin/console make:controller AppController --path=/ --route=app_homepage
cat > templates/app/index.html.twig <<END
{% extends 'base.html.twig' %}

{% block body %}
<h1>My Feature!</h1>
Here's an example of some bundle or twig component or stimulus controller in action...
{% endblock %}
END
@xabbuh xabbuh transferred this issue from symfony/symfony Oct 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant