奏鸣曲页bundle - 创建一个页面



我正在尝试使用Sonata Page Bundle,并且我已经安装了它而没有任何问题,但是我很难在页面上添加块。当我查看Sonata Sandbox时,我可以创建页面,当我单击视图页面时,它将自动生成块,而该块在我的项目中不做。

我基本上从Sonata Sandbox复制了设置。同样在Sanbox中,如果我登录了我可以访问页面而无需创建出版物,那么我在项目中找不到错误路由。

cmf_routing:
    chain:
        routers_by_id:
            # enable the DynamicRouter with high priority to allow overwriting configured routes with content
            #symfony_cmf_routing_extra.dynamic_router: 200
            # enable the symfony default router with a lower priority
            sonata.page.router: 150
            router.default: 100
sonata_page:
    multisite:             host # host_with_path
    use_streamed_response: false # set the value to false in debug mode or if the reverse proxy does not handle streamed response
    ignore_route_patterns:
        - (.*)admin(.*)     # ignore admin route, ie route containing 'admin'
        - ^_(.*)            # ignore symfony routes
    ignore_routes:
        - sonata_page_cache_esi
        - sonata_page_cache_ssi
        - sonata_page_js_sync_cache
        - sonata_page_js_async_cache
        - sonata_cache_esi
        - sonata_cache_ssi
        - sonata_cache_js_async
        - sonata_cache_js_sync
        - sonata_cache_apc
    ignore_uri_patterns:
        - admin(.*)         # ignore admin route, ie route containing 'admin'
    cache_invalidation:
        service:  sonata.page.cache.invalidation.simple
        recorder: sonata.page.cache.recorder
        classes:
            "ApplicationSonataPageBundleEntityBlock": getId
    default_template: default
    templates:
        default: { path: 'SonataPageBundle::layout.html.twig', name: 'default' }
        2col: { path: 'SonataPageBundle::2columns_layout.html.twig', name: '2 column' }
    page_defaults:
        homepage: {decorate: false, enabled: true}
    #caches:
    #    esi:
    #        token:    add an unique token here # default is a random value
    #        version:  3                        # version 3 is the default on debian wheezy ...
    #        servers:
    #            # you need to ajust this configuration to match your varnish configuration
    #            - %sonata_page.varnish.command%
    #    ssi:
    #        token:    add an unique token here # default is a random value
    catch_exceptions:
        not_found: [404]    # render 404 page with "not_found" key (name generated: _page_internal_error_{key})
        fatal:     [500]    # so you can use the same page for different http errors or specify specific page for each error

# Enable Doctrine to map the provided entities
doctrine:
    orm:
        entity_managers:
            default:
                mappings:
                    ApplicationSonataPageBundle: ~
                    SonataPageBundle: ~  

感谢您的建议

1-您是正确的,从前端站点,登录,创建页面,然后单击查看页面将自动生成块。这很棒,但是不幸的是该功能将在未来版本中删除(包括说明)

现在使用它,请阅读完整的配置选项

sonata_page:
    (...)
    is_inline_edition_on: true

2-不知道。要执行全球出版物,以防万一:

php app/console sonata:page:update-core-routes --site=all
php app/console sonata:page:create-snapshots --site=all

最新更新