/** * List category trees. The select_node_id request parameter * allow to send back the tree where the node belongs with a selected * attribute * * @param Request $request * * @return array * * @Template * @AclAncestor("pim_enrich_category_list") */ public function listTreeAction(Request $request) { $selectNodeId = $request->get('select_node_id', -1); try { $selectNode = $this->findCategory($selectNodeId); } catch (NotFoundHttpException $e) { $selectNode = $this->userContext->getUserTree(); } return array('trees' => $this->categoryManager->getTrees(), 'selectedTreeId' => $selectNode->isRoot() ? $selectNode->getId() : $selectNode->getRoot(), 'include_sub' => (bool) $this->getRequest()->get('include_sub', false), 'product_count' => (bool) $this->getRequest()->get('with_products_count', true), 'related_entity' => $this->getRequest()->get('related_entity', 'product')); }