When I tried to display a related object in Twig, and that relation is not present because the ID is in the parent entity, but the related entity was not in the current database, Symfony throws a 500 error
// EntityNotFoundException Twig_Error_Runtime An exception has been thrown during the rendering of a template ("Entity of type 'App\Entity\Location' for IDs id(265) was not found").
I'd like to be able to ignore this error and instead display something like "Related object missing".
It seemed like this could be solved by some checking in Twig, but checking if the relation is null or not defined does not work - they both still find the relation, but when a property is called on the related entity, the exception is thrown.
Has anyone solved this problem already?