This change ensures `object_id` uniqueness within `person_document` and `accompanyingcourse_document` tables. It includes migration scripts and entity annotations to enforce these constraints. This helps maintain data integrity and consistency across the database.
Introduce a service to restore stored object versions along with relevant tests and an API endpoint. This includes database migrations for version relationships, enhancing stored object version tracking.
Implemented a new StoredObjectPointInTime entity to manage snapshots of stored objects. This includes related migrations, enum for reasons, repository, and integration with StoredObjectVersion.
Removed the resetStoredObject() method call from StoredObject, adjusted the storedObjectId column in the stored_object_version table to be NOT NULL, and moved the association setup of the StoredObject entity directly into the constructor in StoredObjectVersion. This ensures that every StoredObjectVersion has a valid StoredObject and maintains database integrity.
This update introduces a versioning system to the stored objects in the ChillDocStoreBundle. The 'StoredObject' entity now includes several new methods, and maintains a collection of 'StoredObjectVersion' instances. Each time a 'StoredObject' is modified, a new version instance is created and added to the collection, ensuring a history of changes. Migration file for the addition of new database column included. Corresponding tests are also updated.
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`.