getEntityManager()->getEntity($entityType, $entityId); $template = $this->getEntityManager()->getEntity('Template', $templateId); if (!$entity || !$template) { throw new NotFound(); } $this->getContainer()->get('serviceFactory')->create('Pdf')->buildFromTemplate($entity, $template, true); exit; } }