Fixed: re-introduce creator in async doc generation

This commit is contained in:
2023-03-15 13:38:19 +01:00
parent d1bdf41c4c
commit 44ecad2bca
10 changed files with 47 additions and 15 deletions

View File

@@ -9,6 +9,7 @@ use Chill\DocGeneratorBundle\GeneratorDriver\DriverInterface;
use Chill\DocGeneratorBundle\GeneratorDriver\Exception\TemplateException;
use Chill\DocStoreBundle\Entity\StoredObject;
use Chill\DocStoreBundle\Service\StoredObjectManagerInterface;
use Chill\MainBundle\Entity\User;
use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface;
use Symfony\Component\HttpFoundation\File\File;
@@ -55,7 +56,8 @@ class Generator implements GeneratorInterface
array $contextGenerationDataNormalized,
?StoredObject $destinationStoredObject = null,
bool $isTest = false,
?File $testFile = null
?File $testFile = null,
?User $creator = null
): ?string {
if ($destinationStoredObject instanceof StoredObject && StoredObject::STATUS_PENDING !== $destinationStoredObject->getStatus()) {
$this->logger->info(self::LOG_PREFIX.'Aborting generation of an already generated document');
@@ -80,6 +82,7 @@ class Generator implements GeneratorInterface
$contextGenerationDataNormalized = array_merge(
$contextGenerationDataNormalized,
['creator' => $creator],
$context instanceof DocGeneratorContextWithPublicFormInterface ?
$context->contextGenerationDataDenormalize($template, $entity, $contextGenerationDataNormalized)
: []

View File

@@ -4,6 +4,7 @@ namespace Chill\DocGeneratorBundle\Service\Generator;
use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;
use Chill\DocStoreBundle\Entity\StoredObject;
use Chill\MainBundle\Entity\User;
use Symfony\Component\HttpFoundation\File\File;
interface GeneratorInterface
@@ -22,6 +23,7 @@ interface GeneratorInterface
array $contextGenerationDataNormalized,
?StoredObject $destinationStoredObject = null,
bool $isTest = false,
?File $testFile = null
?File $testFile = null,
?User $creator = null
): ?string;
}