mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
The documents are now generated in a queue, using symfony messenger. This queue should be configured: ```yaml # app/config/messenger.yaml framework: messenger: # reset services after consuming messages # reset_on_message: true failure_transport: failed transports: # https://symfony.com/doc/current/messenger.html#transport-configuration async: '%env(MESSENGER_TRANSPORT_DSN)%' priority: dsn: '%env(MESSENGER_TRANSPORT_DSN)%' failed: 'doctrine://default?queue_name=failed' routing: # ... other messages 'Chill\DocGeneratorBundle\Service\Messenger\RequestGenerationMessage': priority ``` `StoredObject`s now have additionnal properties: * status (pending, failure, ready (by default) ), which explain if the document is generated; * a generationTrialCounter, which is incremented on each generation trial, which prevent each generation more than 5 times; The generator computation is moved from the `DocGenTemplateController` to a `Generator` (implementing `GeneratorInterface`. There are new methods to `Context` which allow to normalize/denormalize context data to/from a messenger's `Message`.
68 lines
2.1 KiB
PHP
68 lines
2.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/*
|
|
* Chill is a software for social workers
|
|
*
|
|
* For the full copyright and license information, please view
|
|
* the LICENSE file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace Chill\CalendarBundle\Service\DocGenerator;
|
|
|
|
use Chill\CalendarBundle\Entity\Calendar;
|
|
use Chill\DocGeneratorBundle\Context\DocGeneratorContextWithAdminFormInterface;
|
|
use Chill\DocGeneratorBundle\Context\DocGeneratorContextWithPublicFormInterface;
|
|
use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;
|
|
use Chill\DocStoreBundle\Entity\StoredObject;
|
|
use Symfony\Component\Form\FormBuilderInterface;
|
|
|
|
interface CalendarContextInterface extends DocGeneratorContextWithPublicFormInterface, DocGeneratorContextWithAdminFormInterface
|
|
{
|
|
public function adminFormReverseTransform(array $data): array;
|
|
|
|
public function adminFormTransform(array $data): array;
|
|
|
|
public function buildAdminForm(FormBuilderInterface $builder): void;
|
|
|
|
/**
|
|
* @param Calendar $entity
|
|
*/
|
|
public function buildPublicForm(FormBuilderInterface $builder, DocGeneratorTemplate $template, $entity): void;
|
|
|
|
/**
|
|
* @param Calendar $entity
|
|
*/
|
|
public function getData(DocGeneratorTemplate $template, $entity, array $contextGenerationData = []): array;
|
|
|
|
public function getDescription(): string;
|
|
|
|
public function getEntityClass(): string;
|
|
|
|
/**
|
|
* @param Calendar $entity
|
|
*/
|
|
public function getFormData(DocGeneratorTemplate $template, $entity): array;
|
|
|
|
public static function getKey(): string;
|
|
|
|
public function getName(): string;
|
|
|
|
public function hasAdminForm(): bool;
|
|
|
|
/**
|
|
* @param Calendar $entity
|
|
*/
|
|
public function hasPublicForm(DocGeneratorTemplate $template, $entity): bool;
|
|
|
|
public function contextGenerationDataNormalize(DocGeneratorTemplate $template, $entity, array $data): array;
|
|
|
|
public function contextGenerationDataDenormalize(DocGeneratorTemplate $template, $entity, array $data): array;
|
|
|
|
/**
|
|
* @param Calendar $entity
|
|
*/
|
|
public function storeGenerated(DocGeneratorTemplate $template, StoredObject $storedObject, object $entity, array $contextGenerationData): void;
|
|
}
|