Fix and clean DI configuration for chill_doc_store for usage with AsyncUpload

This commit is contained in:
Julien Fastré 2023-12-11 16:09:06 +01:00
parent a70572266f
commit 450e7c348b
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
3 changed files with 19 additions and 31 deletions

View File

@ -12,7 +12,7 @@ declare(strict_types=1);
namespace Chill\DocStoreBundle\Service; namespace Chill\DocStoreBundle\Service;
use Base64Url\Base64Url; use Base64Url\Base64Url;
use ChampsLibres\AsyncUploaderBundle\TempUrl\TempUrlGeneratorInterface; use Chill\DocStoreBundle\AsyncUpload\TempUrlGeneratorInterface;
use Chill\DocStoreBundle\Entity\StoredObject; use Chill\DocStoreBundle\Entity\StoredObject;
use Chill\DocStoreBundle\Exception\StoredObjectManagerException; use Chill\DocStoreBundle\Exception\StoredObjectManagerException;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
@ -27,7 +27,10 @@ final class StoredObjectManager implements StoredObjectManagerInterface
private array $inMemory = []; private array $inMemory = [];
public function __construct(private readonly HttpClientInterface $client, private readonly TempUrlGeneratorInterface $tempUrlGenerator) {} public function __construct(
private readonly HttpClientInterface $client,
private readonly TempUrlGeneratorInterface $tempUrlGenerator
) {}
public function getLastModified(StoredObject $document): \DateTimeInterface public function getLastModified(StoredObject $document): \DateTimeInterface
{ {

View File

@ -1,11 +1,12 @@
parameters:
# cl_chill_person.example.class: Chill\PersonBundle\Example
services: services:
Chill\DocStoreBundle\Repository\: _defaults:
autowire: true autowire: true
autoconfigure: true autoconfigure: true
Chill\DocStoreBundle\Repository\:
resource: "../Repository/" resource: "../Repository/"
tags:
- { name: doctrine.repository_service }
Chill\DocStoreBundle\Form\DocumentCategoryType: Chill\DocStoreBundle\Form\DocumentCategoryType:
class: Chill\DocStoreBundle\Form\DocumentCategoryType class: Chill\DocStoreBundle\Form\DocumentCategoryType
@ -15,8 +16,6 @@ services:
Chill\DocStoreBundle\Form\PersonDocumentType: Chill\DocStoreBundle\Form\PersonDocumentType:
class: Chill\DocStoreBundle\Form\PersonDocumentType class: Chill\DocStoreBundle\Form\PersonDocumentType
autowire: true
autoconfigure: true
# arguments: # arguments:
# - "@chill.main.helper.translatable_string" # - "@chill.main.helper.translatable_string"
tags: tags:
@ -24,50 +23,41 @@ services:
Chill\DocStoreBundle\Security\Authorization\: Chill\DocStoreBundle\Security\Authorization\:
resource: "./../Security/Authorization" resource: "./../Security/Authorization"
autowire: true
autoconfigure: true
tags: tags:
- { name: chill.role } - { name: chill.role }
Chill\DocStoreBundle\Workflow\: Chill\DocStoreBundle\Workflow\:
resource: './../Workflow/' resource: './../Workflow/'
autoconfigure: true
autowire: true
Chill\DocStoreBundle\Serializer\Normalizer\: Chill\DocStoreBundle\Serializer\Normalizer\:
autowire: true
resource: '../Serializer/Normalizer/' resource: '../Serializer/Normalizer/'
tags: tags:
- { name: 'serializer.normalizer', priority: 16 } - { name: serializer.normalizer, priority: 16 }
Chill\DocStoreBundle\Service\: Chill\DocStoreBundle\Service\:
autowire: true
autoconfigure: true
resource: '../Service/' resource: '../Service/'
Chill\DocStoreBundle\GenericDoc\Manager: Chill\DocStoreBundle\GenericDoc\Manager:
autowire: true
autoconfigure: true
arguments: arguments:
$providersForAccompanyingPeriod: !tagged_iterator chill_doc_store.generic_doc_accompanying_period_provider $providersForAccompanyingPeriod: !tagged_iterator chill_doc_store.generic_doc_accompanying_period_provider
$providersForPerson: !tagged_iterator chill_doc_store.generic_doc_person_provider $providersForPerson: !tagged_iterator chill_doc_store.generic_doc_person_provider
Chill\DocStoreBundle\GenericDoc\Twig\GenericDocExtension: Chill\DocStoreBundle\GenericDoc\Twig\GenericDocExtension: ~
autoconfigure: true
autowire: true
Chill\DocStoreBundle\GenericDoc\Twig\GenericDocExtensionRuntime: Chill\DocStoreBundle\GenericDoc\Twig\GenericDocExtensionRuntime:
autoconfigure: true
autowire: true
arguments: arguments:
$renderers: !tagged_iterator chill_doc_store.generic_doc_renderer $renderers: !tagged_iterator chill_doc_store.generic_doc_renderer
Chill\DocStoreBundle\GenericDoc\Providers\: Chill\DocStoreBundle\GenericDoc\Providers\:
autowire: true
autoconfigure: true
resource: '../GenericDoc/Providers/' resource: '../GenericDoc/Providers/'
Chill\DocStoreBundle\GenericDoc\Renderer\: Chill\DocStoreBundle\GenericDoc\Renderer\:
resource: '../GenericDoc/Renderer/'
Chill\DocStoreBundle\AsyncUpload\Driver\:
autowire: true autowire: true
autoconfigure: true autoconfigure: true
resource: '../GenericDoc/Renderer/' resource: '../AsyncUpload/Driver/'
Chill\DocStoreBundle\AsyncUpload\TempUrlGeneratorInterface:
alias: Chill\DocStoreBundle\AsyncUpload\Driver\OpenstackObjectStore\TempUrlOpenstackGenerator

View File

@ -11,7 +11,6 @@ declare(strict_types=1);
namespace Symfony\Component\DependencyInjection\Loader\Configurator; namespace Symfony\Component\DependencyInjection\Loader\Configurator;
use ChampsLibres\AsyncUploaderBundle\TempUrl\TempUrlGeneratorInterface;
use ChampsLibres\WopiBundle\Contracts\AuthorizationManagerInterface; use ChampsLibres\WopiBundle\Contracts\AuthorizationManagerInterface;
use ChampsLibres\WopiBundle\Contracts\UserManagerInterface; use ChampsLibres\WopiBundle\Contracts\UserManagerInterface;
use ChampsLibres\WopiBundle\Service\Wopi as CLWopi; use ChampsLibres\WopiBundle\Service\Wopi as CLWopi;
@ -60,8 +59,4 @@ return static function (ContainerConfigurator $container) {
->set(UserManager::class); ->set(UserManager::class);
$services->alias(UserManagerInterface::class, UserManager::class); $services->alias(UserManagerInterface::class, UserManager::class);
// TODO: Move this into the async bundle (low priority)
$services
->alias(TempUrlGeneratorInterface::class, 'async_uploader.temp_url_generator');
}; };