File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -2082,6 +2082,7 @@ accessed via the ``getUser()`` shortcut in the
2082
2082
2083
2083
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
2084
2084
use Symfony\Component\HttpFoundation\Response;
2085
+ use Symfony\Component\Security\Http\Attribute\CurrentUser;
2085
2086
2086
2087
class ProfileController extends AbstractController
2087
2088
{
@@ -2100,6 +2101,11 @@ accessed via the ``getUser()`` shortcut in the
2100
2101
// For example, if you added a getFirstName() method, you can use that.
2101
2102
return new Response('Well hi there '.$user->getFirstName());
2102
2103
}
2104
+
2105
+ public function me(#[CurrentUser] User $user): Response
2106
+ {
2107
+ // $user is an instance of \App\Entity\User
2108
+ }
2103
2109
}
2104
2110
2105
2111
Fetching the User from a Service
You can’t perform that action at this time.
0 commit comments