当我尝试使用config.yml中定义的参数作为sonata_seo.page.metas.property.fb: app_id
的值时,我收到错误消息。如果将此相同参数用作sonata_seo.page.title
的值,则一切都按预期工作。
应用程序/配置/ config.yml
parameters:
facebook_app_id: 1234567890
sonata_seo:
encoding: UTF-8
page:
default: sonata.seo.page.default
title: "%facebook_app_id%" # here receive correctly
metas:
property:
# Facebook application settings
"fb:app_id": "%facebook_app_id%" # here broke the code
我希望这个HTML标签呈现:
<title>1234567890</title>
<meta property="fb:app_id" content="1234567890" />
php app/console cache:clear --env=prod
结果是:
[Symfony\Component\Debug\Exception\ContextErrorException]
Catchable Fatal Error: Argument 4 passed to Sonata\SeoBundle\Seo\SeoPage::addMeta() must be of the type array, null given, called in .../vendor/sonata-project/seo-bundle/Seo/SeoPage.php on line 146 and defined
答案 0 :(得分:0)
我找到了解决方案:
应用程序/配置/ config.yml
parameters:
facebook_app_id: "1234567890"