本文整理汇总了PHP中Pim\Bundle\UserBundle\Context\UserContext::getUserCategoryTree方法的典型用法代码示例。如果您正苦于以下问题:PHP UserContext::getUserCategoryTree方法的具体用法?PHP UserContext::getUserCategoryTree怎么用?PHP UserContext::getUserCategoryTree使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pim\Bundle\UserBundle\Context\UserContext
的用法示例。
在下文中一共展示了UserContext::getUserCategoryTree方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: listTreeAction
/**
* List category trees. The select_node_id request parameter
* allow to send back the tree where the node belongs with a selected reef attribute
*
* @param Request $request
*
* @throws AccessDeniedException
*
* @return array
*
* @Template
*/
public function listTreeAction(Request $request)
{
if (false === $this->securityFacade->isGranted($this->buildAclName('category_list'))) {
throw new AccessDeniedException();
}
$selectNodeId = $request->get('select_node_id', -1);
try {
$selectNode = $this->findCategory($selectNodeId);
} catch (NotFoundHttpException $e) {
$selectNode = $this->userContext->getUserCategoryTree($this->rawConfiguration['related_entity']);
}
return ['trees' => $this->categoryRepository->getTrees(), 'selectedTreeId' => $selectNode->isRoot() ? $selectNode->getId() : $selectNode->getRoot(), 'include_sub' => (bool) $request->get('include_sub', false), 'item_count' => (bool) $request->get('with_items_count', true), 'related_entity' => $this->rawConfiguration['related_entity']];
}