/** * @param \Orm\Zed\Category\Persistence\SpyCategoryNode $node * * @return void */ protected function renderChildren(SpyCategoryNode $node) { $children = $this->queryContainer->queryFirstLevelChildrenByIdLocale($node->getPrimaryKey(), $this->locale->getIdLocale())->find(); $deleteLink = '/category-tree/index/delete-node?id='; $deleteString = '<br/>click to delete'; $this->addClosureConnections($node); $this->graph->addNode($this->getNodeHash($node), ['URL' => $deleteLink . $node->getPrimaryKey(), 'label' => $this->getNodeName($node) . $deleteString, 'fontsize' => $this->fontSize]); foreach ($children as $child) { $this->graph->addNode($this->getNodeHash($child), ['URL' => $deleteLink . $child->getPrimaryKey(), 'label' => $this->getNodeName($child) . $deleteString, 'fontsize' => $this->fontSize]); $this->graph->addEdge($this->getNodeHash($node), $this->getNodeHash($child)); /* * Recursive call */ $this->renderChildren($child); } }
/** * @param int $idNode * @param \Generated\Shared\Transfer\LocaleTransfer $locale * * @return \Orm\Zed\Category\Persistence\SpyCategoryNode[]|\Propel\Runtime\Collection\ObjectCollection */ public function getChildren($idNode, LocaleTransfer $locale) { return $this->queryContainer->queryFirstLevelChildrenByIdLocale($idNode, $locale->getIdLocale())->find(); }