mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
Associate generate document with evaluation and update UX to go back to
documents
This commit is contained in:
@@ -4,6 +4,9 @@ namespace Chill\DocGeneratorBundle\Controller;
|
||||
|
||||
use Chill\DocGeneratorBundle\Repository\DocGeneratorTemplateRepository;
|
||||
use Chill\DocStoreBundle\Entity\StoredObject;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluation;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluationDocument;
|
||||
use Chill\PersonBundle\Entity\SocialWork\Evaluation;
|
||||
use GuzzleHttp\Exception\TransferException;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
@@ -105,14 +108,26 @@ class DocGeneratorTemplateController extends AbstractController
|
||||
]);
|
||||
|
||||
if ($putResponse->getStatusCode() == 201) {
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$storedObject = new StoredObject();
|
||||
$storedObject
|
||||
// currently, only docx is supported
|
||||
->setType('application/vnd.openxmlformats-officedocument.wordprocessingml.document')
|
||||
->setFilename($genDocName);
|
||||
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$em->persist($storedObject);
|
||||
|
||||
// Only for evaluation
|
||||
if ($entity instanceof AccompanyingPeriodWorkEvaluation) {
|
||||
$doc = new AccompanyingPeriodWorkEvaluationDocument();
|
||||
$doc
|
||||
->setStoredObject($storedObject)
|
||||
->setTemplate($template)
|
||||
;
|
||||
$entity->addDocument($doc);
|
||||
$em->persist($doc);
|
||||
}
|
||||
|
||||
$em->flush();
|
||||
|
||||
return $this->redirectToRoute('chill_wopi_file_edit', [
|
||||
|
Reference in New Issue
Block a user