Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit419e934

Browse files
weaverryanchalasr
authored andcommitted
Proposing Flex-specific error messages in the controller shortcuts
1 parent5725e2f commit419e934

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

‎src/Symfony/Bundle/FrameworkBundle/Controller/ControllerTrait.php‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ protected function file($file, $fileName = null, $disposition = ResponseHeaderBa
194194
protectedfunctionaddFlash($type,$message)
195195
{
196196
if (!$this->container->has('session')) {
197-
thrownew \LogicException('You can not use the addFlash method if sessions are disabled.');
197+
thrownew \LogicException('You can not use the addFlash method if sessions are disabled. Enable them in "config/packages/framework.yaml".');
198198
}
199199

200200
$this->container->get('session')->getFlashBag()->add($type,$message);
@@ -215,7 +215,7 @@ protected function addFlash($type, $message)
215215
protectedfunctionisGranted($attributes,$subject =null)
216216
{
217217
if (!$this->container->has('security.authorization_checker')) {
218-
thrownew \LogicException('The SecurityBundle is not registered in your application.');
218+
thrownew \LogicException('The SecurityBundle is not registered in your application. Try running "composer require security".');
219219
}
220220

221221
return$this->container->get('security.authorization_checker')->isGranted($attributes,$subject);
@@ -261,7 +261,7 @@ protected function renderView($view, array $parameters = array())
261261
}
262262

263263
if (!$this->container->has('twig')) {
264-
thrownew \LogicException('You can not use the "renderView" method if the Templating Component or the Twig Bundle are not available.');
264+
thrownew \LogicException('You can not use the "renderView" method if the Templating Component or the Twig Bundle are not available. Try running "composer require twig".');
265265
}
266266

267267
return$this->container->get('twig')->render($view,$parameters);
@@ -285,7 +285,7 @@ protected function render($view, array $parameters = array(), Response $response
285285
}elseif ($this->container->has('twig')) {
286286
$content =$this->container->get('twig')->render($view,$parameters);
287287
}else {
288-
thrownew \LogicException('You can not use the "render" method if the Templating Component or the Twig Bundle are not available.');
288+
thrownew \LogicException('You can not use the "render" method if the Templating Component or the Twig Bundle are not available. Try running "composer require twig".');
289289
}
290290

291291
if (null ===$response) {
@@ -323,7 +323,7 @@ protected function stream($view, array $parameters = array(), StreamedResponse $
323323
$twig->display($view,$parameters);
324324
};
325325
}else {
326-
thrownew \LogicException('You can not use the "stream" method if the Templating Component or the Twig Bundle are not available.');
326+
thrownew \LogicException('You can not use the "stream" method if the Templating Component or the Twig Bundle are not available. Try running "composer require twig".');
327327
}
328328

329329
if (null ===$response) {
@@ -373,7 +373,7 @@ protected function createNotFoundException($message = 'Not Found', \Exception $p
373373
protectedfunctioncreateAccessDeniedException($message ='Access Denied.',\Exception$previous =null)
374374
{
375375
if (!class_exists(AccessDeniedException::class)) {
376-
thrownew \LogicException('You can not use the "createAccessDeniedException" method if the Security component is not available.');
376+
thrownew \LogicException('You can not use the "createAccessDeniedException" method if the Security component is not available. Try running "composer require security".');
377377
}
378378

379379
returnnewAccessDeniedException($message,$previous);
@@ -422,7 +422,7 @@ protected function createFormBuilder($data = null, array $options = array())
422422
protectedfunctiongetDoctrine()
423423
{
424424
if (!$this->container->has('doctrine')) {
425-
thrownew \LogicException('The DoctrineBundle is not registered in your application.');
425+
thrownew \LogicException('The DoctrineBundle is not registered in your application. Try running "composer require doctrine".');
426426
}
427427

428428
return$this->container->get('doctrine');
@@ -442,7 +442,7 @@ protected function getDoctrine()
442442
protectedfunctiongetUser()
443443
{
444444
if (!$this->container->has('security.token_storage')) {
445-
thrownew \LogicException('The SecurityBundle is not registered in your application.');
445+
thrownew \LogicException('The SecurityBundle is not registered in your application. Try running "composer require security".');
446446
}
447447

448448
if (null ===$token =$this->container->get('security.token_storage')->getToken()) {
@@ -470,7 +470,7 @@ protected function getUser()
470470
protectedfunctionisCsrfTokenValid($id,$token)
471471
{
472472
if (!$this->container->has('security.csrf.token_manager')) {
473-
thrownew \LogicException('CSRF protection is not enabled in your application.');
473+
thrownew \LogicException('CSRF protection is not enabled in your application. Enable it with the "csrf_protection" key in "config/packages/framework.yaml".');
474474
}
475475

476476
return$this->container->get('security.csrf.token_manager')->isTokenValid(newCsrfToken($id,$token));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp