本文整理匯總了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']];
}