我想這是一個足夠簡單的事情。我只想使用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