setEntityName(); } abstract protected function setEntityName():void; protected function loadEntityById(int $id): EntityInterface { $entity = $this->getDoctrine() ->getRepository($this->entityName) ->find($id); if (!$entity) { throw $this->createNotFoundException('No entity found for id '.$id); } return $entity; } }