Pimcore 将 6.9 更新到 10 后出现 ParameterNotFoundException
ParameterNotFoundException after Pimcore update 6.9 to 10
这是我目前在尝试执行例如./bin/console cache:clear
。但也适用于所有其他命令。
Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException^ {#1391
-key: "secret"
-sourceId: null
-sourceKey: null
-alternatives: []
-nonNestedAlternative: null
#message: "You have requested a non-existent parameter "secret"."
#code: 0
#file: "./vendor/symfony/dependency-injection/ParameterBag/ParameterBag.php"
#line: 93
trace: {
./vendor/symfony/dependency-injection/ParameterBag/ParameterBag.php:93 { …}
./vendor/symfony/dependency-injection/ParameterBag/EnvPlaceholderParameterBag.php:61 { …}
./vendor/symfony/dependency-injection/ParameterBag/ParameterBag.php:203 { …}
./vendor/symfony/dependency-injection/ParameterBag/ParameterBag.php:175 { …}
./vendor/symfony/dependency-injection/ParameterBag/ParameterBag.php:165 { …}
./vendor/symfony/dependency-injection/ParameterBag/ParameterBag.php:165 { …}
./vendor/symfony/dependency-injection/Compiler/MergeExtensionConfigurationPass.php:62 { …}
./vendor/symfony/http-kernel/DependencyInjection/MergeExtensionConfigurationPass.php:39 { …}
./vendor/symfony/dependency-injection/Compiler/Compiler.php:91 { …}
./vendor/symfony/dependency-injection/ContainerBuilder.php:744 { …}
./vendor/symfony/http-kernel/Kernel.php:545 { …}
./vendor/pimcore/pimcore/lib/Kernel.php:237 { …}
./vendor/symfony/http-kernel/Kernel.php:786 { …}
./vendor/symfony/http-kernel/Kernel.php:125 { …}
./vendor/pimcore/pimcore/lib/Kernel.php:216 { …}
./vendor/pimcore/pimcore/lib/Bootstrap.php:255 { …}
./vendor/pimcore/pimcore/lib/Bootstrap.php:60 { …}
./bin/console:24 {
› /** @var \Pimcore\Kernel $kernel */
› $kernel = \Pimcore\Bootstrap::startupCli();
› $application = new \Pimcore\Console\Application($kernel);
}
}
}
文件内容config/config.yml
:
imports:
- { resource: parameters.yml }
- { resource: security.yml }
- { resource: services.yml }
- { resource: 'local/' }
...
在config/local/parameters.yml
中:
parameters:
secret: mysecret
...
我也尝试将秘密放入 config/services.yml
中,就像骨架示例中那样。
我必须在哪里放置 secret
参数才能从系统中找到它?
我可以通过将配置文件从 .yml
重命名为 .yaml
来解决我这边的问题。
所以我的 /config
文件夹现在看起来像这样:
我还必须将 config/packages/$ENV/*.yaml
下环境特定配置中的导入更改为此(注意 ../../
):
imports:
- { resource: ../../config.yaml }
我也将 parameters
配置放入 services.yaml
就像在 pimcore 演示中一样:https://github.com/pimcore/demo/blob/5f0577f4b801e2ca594efc94364600a7a0aee505/config/services.yaml#L1
这是我目前在尝试执行例如./bin/console cache:clear
。但也适用于所有其他命令。
Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException^ {#1391
-key: "secret"
-sourceId: null
-sourceKey: null
-alternatives: []
-nonNestedAlternative: null
#message: "You have requested a non-existent parameter "secret"."
#code: 0
#file: "./vendor/symfony/dependency-injection/ParameterBag/ParameterBag.php"
#line: 93
trace: {
./vendor/symfony/dependency-injection/ParameterBag/ParameterBag.php:93 { …}
./vendor/symfony/dependency-injection/ParameterBag/EnvPlaceholderParameterBag.php:61 { …}
./vendor/symfony/dependency-injection/ParameterBag/ParameterBag.php:203 { …}
./vendor/symfony/dependency-injection/ParameterBag/ParameterBag.php:175 { …}
./vendor/symfony/dependency-injection/ParameterBag/ParameterBag.php:165 { …}
./vendor/symfony/dependency-injection/ParameterBag/ParameterBag.php:165 { …}
./vendor/symfony/dependency-injection/Compiler/MergeExtensionConfigurationPass.php:62 { …}
./vendor/symfony/http-kernel/DependencyInjection/MergeExtensionConfigurationPass.php:39 { …}
./vendor/symfony/dependency-injection/Compiler/Compiler.php:91 { …}
./vendor/symfony/dependency-injection/ContainerBuilder.php:744 { …}
./vendor/symfony/http-kernel/Kernel.php:545 { …}
./vendor/pimcore/pimcore/lib/Kernel.php:237 { …}
./vendor/symfony/http-kernel/Kernel.php:786 { …}
./vendor/symfony/http-kernel/Kernel.php:125 { …}
./vendor/pimcore/pimcore/lib/Kernel.php:216 { …}
./vendor/pimcore/pimcore/lib/Bootstrap.php:255 { …}
./vendor/pimcore/pimcore/lib/Bootstrap.php:60 { …}
./bin/console:24 {
› /** @var \Pimcore\Kernel $kernel */
› $kernel = \Pimcore\Bootstrap::startupCli();
› $application = new \Pimcore\Console\Application($kernel);
}
}
}
文件内容config/config.yml
:
imports:
- { resource: parameters.yml }
- { resource: security.yml }
- { resource: services.yml }
- { resource: 'local/' }
...
在config/local/parameters.yml
中:
parameters:
secret: mysecret
...
我也尝试将秘密放入 config/services.yml
中,就像骨架示例中那样。
我必须在哪里放置 secret
参数才能从系统中找到它?
我可以通过将配置文件从 .yml
重命名为 .yaml
来解决我这边的问题。
所以我的 /config
文件夹现在看起来像这样:
我还必须将 config/packages/$ENV/*.yaml
下环境特定配置中的导入更改为此(注意 ../../
):
imports:
- { resource: ../../config.yaml }
我也将 parameters
配置放入 services.yaml
就像在 pimcore 演示中一样:https://github.com/pimcore/demo/blob/5f0577f4b801e2ca594efc94364600a7a0aee505/config/services.yaml#L1