0
votes

I was reviewing the symfony 3.4 routing page. I have a misunderstanding if anyone can help me. So say you have the following:
In Your controller:

class BlogController extends Controller
{
    /**
     * Matches /blog exactly
     *
     * @Route("/blog", name="blog_list")
     */
    public function listAction()
    {
        // ...
    }
}

And in your routing.yml:

blog_list:
    path:     /blog
    defaults: { _controller: AppBundle:Blog:list }

Would you be able to delete the route annotation above the function. Because now the routing is being handled by the routing.yml?
Many thanks

2

2 Answers

0
votes

You must choose one of this methods to set route for current url "/blog"

0
votes

In Symfony Routing can be declare using YAML, XML, PHP or annotation. It is recommended you stick with only one but you can use multiple approaches in a single project.

Official doc for routing Symfony Routing

and the answer to your question is, I would say yes you could delete the annotation. Because now the routing is being handled by the routing.yml

for the big project, I prefer YML routing.