Created
April 12, 2019 14:55
-
-
Save romaricdrigon/1ca0e2cc0df7aa72afcb03119336856e to your computer and use it in GitHub Desktop.
But de l'article "Récupérer plus simplement l'utilisateur dans un contrôleur Symfony"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Controller; | |
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | |
use Symfony\Component\Routing\Annotation\Route; | |
use Symfony\Component\Security\Core\User\UserInterface; | |
class MyController extends AbstractController | |
{ | |
/** | |
* @Route("/dashboard", name="dashboard") | |
*/ | |
public function index(Request $request, UserInterface $user) | |
{ | |
return new Response(sprintf('Hello %s', $user->getUsername()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment