loremipsum/route-generator-bundle
最新稳定版本:v0.4.2
Composer 安装命令:
composer require loremipsum/route-generator-bundle
包简介
Symfony bundle to create routes to resources.
关键字:
README 文档
README
Symfony bundle to create routes to resources.
Example route handler
<?php namespace App\RouteHandlers; use App\Entity\User; use LoremIpsum\RouteGeneratorBundle\Model\RouteHandlerInterface; use Symfony\Component\Routing\RouterInterface; class DefaultRouteHandler implements RouteHandlerInterface { protected $router; public function __construct(RouterInterface $router) { $this->router = $router; } public function handle($value, $view = null, $context = []) { if ($value instanceof User) { return $this->router->generate('userView', array_merge(['user' => $value->getId()], $context)); } return null; } }
Example usage
{% if <entity> is routable %}
<a href="{{ pathTo(<entity>) }}">{{ <entity> }}</a>
{% else %}
{{ <entity> }}
{% endif %}
统计信息
- 总下载量: 102
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-12-27