I'm using annotations in the project.
In the file routing.yml
I have the following configuration:
acme_store:
resource: "@AcmeStoreBundle/Controller/"
type: annotation
prefix: /acme
teste_blog:
resource: "@TesteBlogBundle/Controller/"
type: annotation
prefix: /
Note that in the% bundle% with% I am using the AcmeStore
prefix.
In the controller class acme
of the bundle DefaultController.php
, I have the following configured route:
/**
* @Route("/", name="index")
*/
public function indexAction()
{
return $this->render('AcmeStoreBundle:Default:index.html.twig');
}
In the controller class AcmeStore
of the bundle DefaultController.php
, I have the following configured route:
/**
* @Route("/", name="index")
*/
public function indexAction()
{
return $this->render('TesteBlogBundle:Default:index.html.twig');
}
Notice that the TesteBlog
property is equal in both controllers.
At the console, running the command name
returns the following result:
------- ------- ------- ----- -----
Name Method Scheme Host Path
------- ------- ------- ----- -----
index ANY ANY ANY /
Should not there be another line?
------- ------- ------- ----- -----
Name Method Scheme Host Path
------- ------- ------- ----- -----
index ANY ANY ANY /
index ANY ANY ANY /acme
If even using a prefix we can not use the same php app/console debug:router
for different routes, what are the best practices when we choose a name for the route?
I ask this because it is possible to install third-party bundles and this can lead to conflicts.