Context
I'm learning symfony2 ?
So that you understand the idea of the MVC
It's the basic idea. Now from Symfony's point of view, it would work in the following way:
namespace Nombre\NamespaceBundleArtekBoard\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
//List es el nombre del controlador, acá uso una función userList (el Action es para identificar por symfony2 que usas una 'acción')
class ListController extends Controller
{
public function userListAction()
{
return $this->render('NombreDelBundle:RutaDeLaCarpetaView:list.html.twig');
}
}
And in the view (list.html.twig, for this example)
<html>
<head></head>
<body>
Hola Mundo ^^
</body>
</html>
But, how do I get from the URL (for example www.dominio.cl/listarUsuario) to the controller and all that ?, I create a route in the config / routing of my Bundle
alias_de_yaml:
path: /user/
defaults: { _controller: NombreDelBundle:List:userList }
(Note that the 'Controller' of UserController and the Action of userListAction are not added)
That would be a very basic example of the idea you need.
An interesting link is this (it's a bit old, since we're going in version 2.8.2 and 3.0.1) where you can learn the basics of Symfony2
Also if you want you can see this 'project' (which I have shot) using Symfony 2.8 for you to make a reference.
greetings