我在Symfony 4上设置了Sonata-Page,Admin ...
ip http://10.2.0.6是docker服务器ip
运行
bin/console sonata:page:create-snapshots --site=all
bin/console sonata:page:update-core-routes --site=all
启用页面
但总是
在
在Sonata \ PageBundle \ Site公共函数retrieve()中得到
arrayPrint.php on line 64:
HostSiteSelector {#211 ▼
#siteManager: SiteManager {#220 ▶}
#decoratorStrategy: DecoratorStrategy {#213 ▶}
#seoPage: SeoPage {#214 ▶}
#site: null
谁填写此变量,为什么为空?
我看到监听器(Sonata \ PageBundle \ Listener \ RequestListener onCoreReques)被触发并尝试从此方法站点对象获取。
在同一班上,我看到
protected function getSites(Request $request)
当我丢弃它时,我得到
arrayPrint.php on line 64:
array:1 [▼
0 => SonataPageSite {#460 ▼
#id: 1
#enabled: true
#createdAt: DateTime @1533546625 {#483 ▶}
#updatedAt: DateTime @1533541412 {#505 ▶}
#name: "localhost"
#host: "10.2.0.6"
#relativePath: null
#enabledFrom: DateTime @1533546622 {#484 ▶}
#enabledTo: DateTime @1849165822 {#464 ▶}
#isDefault: true
#formats: []
#locale: "en_GB"
#title: null
#metaKeywords: null
#metaDescription: null
}
]
答案 0 :(得分:0)
好,我找到了原因-我创建了一个页面,如手动说
php app/console sonata:page:create-site --enabled=true --name=localhost --locale=- --host=localhost --relativePath=/ --enabledFrom=now --enabledTo="+10 years" --default=true
enabledFrom = now,我不知道为什么,但是我在GMT中的时间不是我的时区,所以如果我等待小时,那么网站在当前时间是不可见的。我认为这不好。默认情况下,页面应可见且不受限制。