On the routing page of smyfony is an routing example (the first one). Now they give us 4 options of code (Annotations, YAML, XML, PHP). Where is the difference? And maybe you can take a look on my Controller + Route
.
The controller looks like this:
<?php
namespace AppBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
class ToDoListController extends Controller
{
/**
* @Route("/ToDoList", name="ToDoList")
*/
public function showToDoList()
{
}
}
?>
Now I added this route into the routing.yml
too.
ToDoList:
path: /Aufgabenliste
defaults: {_controller: AppBundle\Controller \ToDoListController::showToDoList}
Is that correct? Whats about the path? In the first example of the symfony page they wrote defaults: { _controller: AppBundle:Blog:show }
but in the description they wrote:
The _controller string is called the logical name. It follows a pattern that points to a specific PHP class and method, in this case the AppBundle\Controller\BlogController::listAction and AppBundle\Controller\BlogController::showAction methods.
routing.yml
correct? MyToDoListController
is locadet in\src\AppBundle\Controller\ToDoListController.php
– MyNewName