eschmar/doctrine-routing-bundle

为 Symfony2 提供动态数据库路由。

1.1.1 2015-04-09 22:11 UTC

This package is auto-updated.

Last update: 2024-09-11 19:51:19 UTC


README

使用此扩展包,您可以将部分路由持久化到数据库中,使用提供的实体 Route。这些路由将被缓存,只有当您清除路由缓存时才会更新。这样,您可以从界面管理路由而不必放弃缓存。该扩展包提供命令行和服务触发清除缓存的功能。

安装

Composer (Packagist)

"require": {
	"eschmar/doctrine-routing-bundle": "dev-master"
},

app/Appkernel.php

new Eschmar\DoctrineRoutingBundle\EschmarDoctrineRoutingBundle(),

app/config/routing.yml

eschmar_doctrine_routing:
    resource: "@EschmarDoctrineRoutingBundle/Resources/config/routing.yml"
    prefix:   /

最后,您需要更新 doctrine 模式以创建数据库表。

使用

将您的路由存储在提供的 RouteRouteConfig 实体中。更新您的路由后,您必须调用

php app/console cache:clear:routing prod

或在一个控制器中

$helper = $this->get('eschmar_doctrine_routing.helper');
$helper->clear('prod');

以清除缓存。

许可证

MIT 许可证