我想这是一个足够简单的事情。我只想使用RoutingAutoBundle为嵌套页面。RoutingAutoBundle嵌套路由(Symfony CMF)
我一起在这里以下http://symfony.com/doc/current/cmf/cookbook/creating_a_cms/
说我有这有一个父Page
文件。
/**
*
* @PHPCR\Document(referenceable=true)
*
* @author Matt Durak <[email protected]>
*/
class Page implements RouteReferrersReadInterface
{
/**
* @PHPCR\Id()
*/
protected $id;
/**
* @PHPCR\ParentDocument()
*/
protected $parent;
//...
/**
* Get ID
*
* @return integer
*/
public function getId()
{
return $this->id;
}
public function getParent()
{
return $this->parent;
}
public function setParent($parent)
{
$this->parent = $parent;
return $this;
}
// ...
}
我的自动路由配置是像这样:
cmf_routing_auto:
mappings:
Study\MainBundle\Document\Page:
content_path:
pages:
provider: [specified, { path: /cms/routes/page }]
exists_action: auto_increment
not_exists_action: create
content_name:
provider: [content_method, { method: getTitle }]
exists_action: auto_increment
not_exists_action: create
我想的东西像下面这样。假设我有我的数据,像这样:
/cms/pages
/page-1
/page-2
/page-A
/page-B
目前,这4页将有以下途径
/page/page-1
/page/page-2
/page/page-A
/page/page-B
我想
/page/page-1
/page/page-2
/page/page-2/page-A
/page/page-2/page-B
我已经尝试添加另一个content_path
与content_object
供应商,并呼吁getParent
,但没有奏效。有谁熟悉Symfony CMF和RoutingAutoBundle知道如何做到这一点?文档很稀疏...
网址应该如何显示? (顺便说一句,这个软件包是完整的文档,它仍然处于测试阶段,所以它缺少一些提示和技巧) –
添加了我看到的路线和我想要的路线。是的,文档缺少超出基础的有用示例。这将是非常有用的 – Matt