Why Symfony2 dont catch exceptions

前端 未结 2 830
孤城傲影
孤城傲影 2021-01-20 17:45

i have a repository

class TurnoRepository extends EntityRepository
{
    public function findTurnoActivo()
    {
        $q = $this
            ->createQu         


        
2条回答
  •  醉话见心
    2021-01-20 18:01

    Symfony2 code is namespaced so you have to add the correct namespace for the class NoResultException, try using:

    catch (\Doctrine\ORM\NoResultException $e)
    

    Note the backslash in front of the Doctrine namespace or import the NoResultException class by using use.

提交回复
热议问题