我想这是一件很简单的事情。我只想将 RoutingAutoBundle 用于嵌套页面。
我在这里关注http://symfony.com/doc/current/cmf/cookbook/creating_a_cms/
假设我有Page
父母的文件。
/**
*
* @PHPCR\Document(referenceable=true)
*
* @author Matt Durak <mattdurak@gmail.com>
*/
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 知道如何做到这一点?文档很少...