symfony2 and throwing exception error

前端 未结 3 453
太阳男子
太阳男子 2021-01-01 12:13

I am trying to throw exceptions and I am doing the following:

use Symfony\\Component\\HttpKernel\\Exception\\HttpNotFoundException;
use Symfony\\Component\\S         


        
3条回答
  •  我在风中等你
    2021-01-01 12:32

    If its in a controller, you can do it this way :

    throw $this->createNotFoundException('Unable to find entity.');
    

提交回复
热议问题