Twig and Symfony2 - Entity was not found

前端 未结 3 1775
慢半拍i
慢半拍i 2020-12-17 16:10

I have an entity that is related to some other entities. On the end, I have an object like tat:

paper.submission.authors

For some of the pa

3条回答
  •  一生所求
    2020-12-17 16:47

    How to debug to find which related entity was not found?

    Exception message improved in repository https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Proxy/ProxyFactory.php#L160 but if you use older version you can do the following debugging.

    If you use older version

    Put following code to ProxyFactory class before throw new EntityNotFoundException(); line vendor/doctrine/orm/lib/Doctrine/ORM/Proxy/ProxyFactory.php:177

    $entity = $classMetadata->getReflectionClass()->getShortName();
    $id = $classMetadata->getIdentifierValues($proxy)['id'];
    var_dump("$entity WHERE id = $id NOT FOUND.");exit;
    throw new EntityNotFoundException();
    

提交回复
热议问题