public function SessionTestController::getSession in Drupal 9
Same name and namespace in other branches
- 8 core/modules/system/tests/modules/session_test/src/Controller/SessionTestController.php \Drupal\session_test\Controller\SessionTestController::getSession()
Returns the values stored in the active session and the user ID.
Parameters
\Symfony\Component\HttpFoundation\Request $request: The request object.
Return value
\Symfony\Component\HttpFoundation\JsonResponse A response object containing the session values and the user ID.
1 string reference to 'SessionTestController::getSession'
- session_test.routing.yml in core/
modules/ system/ tests/ modules/ session_test/ session_test.routing.yml - core/modules/system/tests/modules/session_test/session_test.routing.yml
File
- core/
modules/ system/ tests/ modules/ session_test/ src/ Controller/ SessionTestController.php, line 178
Class
- SessionTestController
- Controller providing page callbacks for the action admin interface.
Namespace
Drupal\session_test\ControllerCode
public function getSession(Request $request) {
return new JsonResponse([
'session' => $request
->getSession()
->all(),
'user' => $this
->currentUser()
->id(),
]);
}