0

I'm following the Symfony3 intro.

I ran php bin/console generate:controller and followed the prompts, choosing YAML for the routing because I don't like comments as code.

It generated the following:

number:
    path:     /lucky/number
    defaults: { _controller: AppBundle:Lucky:number }

And placed it into src/AppBundle/Resources/config/routing.yml

This doesn't work. However, copying the contents to app/config/routing.yml does.

It seems like I'm missing some additional config that it doesn't mention in the guide because it expects you to just use the annotations for the routes. It also doesn't mention anything in the docs here under the "using other formats" section.

Is copying the generated route into the other file the right thing to do? Is there an alternative step that tells it where to find the other YAML based routes?

1 Answer 1

3

In you app/config/routing.yml you can do:

app:
    resource: '@AppBundle/Resources/config/routing.yml'

And then everything you write inside of AppBundle/Resources/config/routing.yml will work

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.