From 8d543be5cc47cebc423872c90e84c0e05c4b49bb Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 11 Jul 2024 15:15:04 +0200 Subject: [PATCH] Add configuration on id_document_types to avoid errors --- .../ChillMainExtension.php | 5 +++++ .../DependencyInjection/Configuration.php | 22 +++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php index 4dde2076c..bf041b5b3 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php @@ -193,6 +193,11 @@ class ChillMainExtension extends Extension implements [] ); + $container->setParameter( + 'chill_main.id_document_kinds', + $config['id_document_kinds'] + ); + $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../config')); $loader->load('services.yaml'); $loader->load('services/doctrine.yaml'); diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php b/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php index 8bd3e35f4..9c890d9fe 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php @@ -151,6 +151,28 @@ class Configuration implements ConfigurationInterface ->append($this->addWidgetsConfiguration('homepage', $this->containerBuilder)) ->end() // end of widgets/children ->end() // end of widgets + ->arrayNode('id_document_kinds')->defaultValue([]) + ->arrayPrototype() + ->children() + ->scalarNode('key')->isRequired()->cannotBeEmpty() + ->info('the key stored in database') + ->example('id_card') + ->end() + ->arrayNode('labels')->isRequired()->requiresAtLeastOneElement() + ->arrayPrototype() + ->children() + ->scalarNode('lang')->isRequired()->cannotBeEmpty() + ->example('fr') + ->end() + ->scalarNode('label')->isRequired()->cannotBeEmpty() + ->example('Carte de séjour') + ->end() + ->end() + ->end() + ->end() + ->end() + ->end() + ->end() // end of document types ->arrayNode('cruds') ->defaultValue([]) ->arrayPrototype()