zorbus/page-bundle

一个 Symphony2 页面包

0.0.1 2012-10-21 00:12 UTC

This package is not auto-updated.

Last update: 2024-09-28 13:42:27 UTC


README

此包允许通过由 Sonata Admin 驱动的管理区域创建网页。数据存储在关系数据库中(仅支持 Doctrine ORM)。

页面由一个主题(一个 twig 模板)和几个区块组成(由 ZorbusBlockBundle 提供)。

在 app/config.yml 中

在 AppKernel.php 中启用 cmf 路由和 doctrine 包

public function registerBundles()
{
    $bundles = array(
        ...,
        new Zorbus\PageBundle\ZorbusPageBundle(),
        new Zorbus\BlockBundle\ZorbusBlockBundle(),
        new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
        new Symfony\Cmf\Bundle\RoutingBundle\CmfRoutingBundle(),
    );
}

添加配置以加载页面路由

cmf_routing:
    chain:
        routers_by_id:
            zorbus.page.router: 300
            router.default: 100

添加配置以启用 doctrine 扩展

stof_doctrine_extensions:
    default_locale: %locale%
    orm:
        default:
            timestampable: true
            sluggable: true
            tree: true
            sortable: true

实体仓库必须扩展模型中提供的一个

zorbus_page:
    entities:
        page: Acme\DemoBundle:Page
        page_block: Acme\DemoBundle:PageBlock
        block: Acme\DemoBundle:Block

添加配置以指向实体,替换接口。它们应该扩展提供的模型。

doctrine:
    orm:
        resolve_target_entities:
            Zorbus\PageBundle\Model\PageInterface: Acme\DemoBundle\Entity\Page
            Zorbus\PageBundle\Model\PageBlockInterface: Acme\DemoBundle\Entity\PageBlock
            Zorbus\BlockBundle\Model\BlockInterface: Acme\DemoBundle\Entity\Block

在 app/routing.yml 中

zorbus_page:
    resource: "@ZorbusPageBundle/Controller"
    type: annotation
    prefix: /

更新数据库

使用 doctrine 迁移或直接更新模式

$ php app/console doctrine:schema:update --force