我使用oro v4.1,我尝试根据https://doc.oroinc.com/4.1/backend/system-configuration/为系统找到配置值
所以
class Configuration implements ConfigurationInterface
{
/**
* {@inheritDoc}
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('web_sys_visit');
// Here you should define the parameters that are allowed to
// configure your bundle. See the documentation linked above for
// more information on that topic.
SettingsBuilder::append($rootNode, [
'nogps' => [
'value' => true,
'type' => 'boolean',
]
]);
return $treeBuilder;
}
}和system_configuration.yml
system_configuration:
groups:
websys_visit_settings:
title: visit setting
fields:
web_sys_visit.nogps:
data_type: boolean
type: Oro\Bundle\ConfigBundle\Form\Type\ConfigCheckbox
priority: 10
options:
label: No GPS
tree:
system_configuration:
platform:
children:
general_setup:
children:
application_settings:
children:
websys_visit_settings:
children:
- web_sys_visit.nogpsclass WebSysVisitExtension extends Extension
{
const ALIAS = 'web_sys_visit';
/**
* {@inheritDoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('services.yml');
$loader->load('form.yml');
}
/**
* {@inheritDoc}
*/
public function getAlias()
{
return self::ALIAS;
}
}当我试图清除缓存时,会出现以下错误
未定义系统配置变量"web_sys_visit.nogps“。请确保将其添加到包配置中。
设置或在配置中标记为"ui_only“。
所以我再加上
ui_only:真
对配置和清除缓存,然后运行oro:实体-配置:更新。
我在系统配置中看到gps配置,但是当我设置值true时,它没有被保存。
我在db中检查oro_confige_value表,没有配置作为nogps (节=web_sys_visit),我应该运行任何命令吗?你能帮我一下吗?谢谢
发布于 2022-03-31 16:25:00
ui_only意味着该值不会被框架自动保存,您必须手动处理它。
配置类似乎没有加载。确保名称空间和文件路径是正确的,并且您的包类名是WebSysVisitBundle,否则扩展名不正确。
https://stackoverflow.com/questions/71457918
复制相似问题