尝试在 OroPlatform 上注册自定义配置时出错

Error while trying to register a custom configuration on OroPlatform

我尝试在 Oro Platform v.4.1.10 上添加自定义全局配置时遇到问题。

当我将其设置为“ui_only”时,我的配置在管理面板中已正确注册,但当我尝试定义它时,它并没有将值保存在数据库中。而且我没有实现设置默认值。

当我删除“ui_only”时出现此错误:

我使用以下 src/Baltimore/Bundle/AppBundle/Resources/config/oro/system_configuration.yml

定义了我的自定义设置
system_configuration:
  groups:
    baltimore_settings:
      title: app.configuration.baltimore.label
      icon: 'fa-building'
    guarantee_pack_settings:
      title: app.configuration.guarantee_pack.label

  fields:
    app_guarantee_pack.honorary_vat_rate:
      data_type: string
      type: Symfony\Component\Form\Extension\Core\Type\TextType
      # ui_only: true
      options:
        label: app.configuration.guarantee_pack.honorary_vat_rate.label

  tree:
    system_configuration:
      platform:
        children:
          general_setup:
            children:
              baltimore_settings:
                priority: 10000
                children:
                  guarantee_pack_settings:
                    children:
                      - app_guarantee_pack.honorary_vat_rate

而且我创建了一个 src/Baltimore/Bundle/AppBundle/DependencyInjection/Configuration.php 文件,但似乎没有考虑到它

<?php

namespace Baltimore\Bundle\AppBundle\DependencyInjection;

use Oro\Bundle\ConfigBundle\DependencyInjection\SettingsBuilder;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;

/**
 * Class Configuration
 * @package Baltimore\Bundle\AppBundle\DependencyInjection
 */
class Configuration implements ConfigurationInterface
{
    /**
     * @return TreeBuilder
     */
    public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder();
        $rootNode = $treeBuilder->root('app_guarantee_pack');

        // $root->children()->scalarNode('honorary_vat_rate')->defaultValue(1.2)->end();

        SettingsBuilder::append($rootNode, [
            'honorary_vat_rate' => [
                'value' => 'test',
            ]
        ]);

        return $treeBuilder;
    }
}

我的包是按以下方式定义的,所以我不明白为什么 DependencyInjection 文件夹中的配置文件没有应用。

# src/Baltimore/Bundle/AppBundle/Resources/config/oro/bundles.yml
bundles:
  - Baltimore\Bundle\AppBundle\BaltimoreAppBundle

我遵循了以下文档以尝试实施我的自定义设置:


感谢您的帮助。

And I've created a src/Baltimore/Bundle/AppBundle/DependencyInjection/Configuration.php file but it seems that it is not taken into account

如果您没有使用依赖注入扩展显式加载它,则不会:

// src/Acme/SocialBundle/DependencyInjection/AcmeSocialExtension.php
public function load(array $configs, ContainerBuilder $container)
{
    $configuration = new Configuration();

    $config = $this->processConfiguration($configuration, $configs);

    // you now have these 2 config keys
    // $config['twitter']['client_id'] and $config['twitter']['client_secret']
}

https://symfony.com/doc/4.4/bundles/configuration.html#processing-the-configs-array

看来 Oro 文档必须就此主题进行扩展。