当前位置: 首页>>代码示例>>PHP>>正文


PHP JTableNested::getTree方法代码示例

本文整理汇总了PHP中JTableNested::getTree方法的典型用法代码示例。如果您正苦于以下问题:PHP JTableNested::getTree方法的具体用法?PHP JTableNested::getTree怎么用?PHP JTableNested::getTree使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JTableNested的用法示例。


在下文中一共展示了JTableNested::getTree方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testGetTree

 public function testGetTree($nodata = false)
 {
     // get Root as tree
     $treeRoot = $this->object->getTree('1');
     $this->assertEquals(68, count($treeRoot), 'Root tree should have 68 nodes');
     $this->assertEquals('1', $treeRoot[0]->id, 'id for element 0 should be 1');
     $this->assertEquals('18', $treeRoot[1]->id, 'id for element 1 should be 18');
     $this->assertEquals('31', $treeRoot[2]->id, 'id for element 2 should be 31');
     $this->assertEquals('9', $treeRoot[67]->id, 'id for element 2 should be 31');
     // get Templates as tree
     $treeTemplates = $this->object->getTree(23);
     $this->assertEquals(5, count($treeTemplates), 'Templates tree should have 5 nodes');
     $this->assertEquals('23', $treeTemplates[0]->id, 'id for element 0 should be 23');
     $this->assertEquals('69', $treeTemplates[1]->id, 'id for element 1 should be 69');
     $this->assertEquals('70', $treeTemplates[2]->id, 'id for element 2 should be 70');
     $this->assertEquals('68', $treeTemplates[3]->id, 'id for element 2 should be 68');
     $this->assertEquals('71', $treeTemplates[4]->id, 'id for element 2 should be 71');
     // get Plugins as tree
     $treePlugins = $this->object->getTree(25);
     $this->assertEquals(1, count($treePlugins), 'Templates tree should have 5 nodes');
     $this->assertEquals('25', $treePlugins[0]->id, 'd for element 0 should be 25');
     // Get invalid node as tree
     $treeInvalid = $this->object->getTree(99999);
     $this->assertEquals(0, count($treeInvalid), 'Invalid tree should have 0 nodes');
     // Test with db error
     $badTable = new JTableCategory($this->badDB);
     $this->assertFalse($badTable->getTree(1), 'Line: ' . __LINE__ . ' Should fail with db error');
 }
开发者ID:Joomla-on-NoSQL,项目名称:LaMojo,代码行数:28,代码来源:JTableNestedTest.php

示例2: getTree

 public function getTree($pk = null, $diagnostic = false)
 {
     $k = $this->_tbl_key;
     $pk = is_null($pk) ? $this->{$k} : $pk;
     if (!isset(self::$getTree[$pk][(int) $diagnostic])) {
         self::$getTree[$pk][(int) $diagnostic] = parent::getTree($pk, $diagnostic);
     }
     return self::$getTree[$pk][(int) $diagnostic];
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:9,代码来源:comment.php


注:本文中的JTableNested::getTree方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。