Sonata Page Bundle - 创建页面

时间:2014-03-07 23:02:32

标签: symfony symfony-sonata

我正在尝试使用Sonata Page Bundle并且我已经安装它没有任何问题,但我在向页面添加块时遇到问题。当我查看Sonata Sandbox时,我可以创建页面,当我单击View Page时,它将自动生成块,这在我的项目中没有。

我基本上复制了奏鸣曲沙箱的设置。另外在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:
            "Application\Sonata\PageBundle\Entity\Block": 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 个答案:

答案 0 :(得分:1)

1 - 您是正确的,从前端站点登录,创建页面然后单击View Page将自动生成块。这很棒,但不幸的是 the feature will be deleted in futur versions (包括解释)

要立即使用它,请阅读Full configuration options

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