getRowsCountRecursive() публичный Метод

Returns the number of rows in the entire DataTable hierarchy. This is the number of rows in this DataTable summed with the row count of each descendant subtable.
public getRowsCountRecursive ( ) : integer
Результат integer
Пример #1
0
 /**
  * we test the count rows and the count rows recursive version
  * on a Complex array (rows with 2 and 3 levels only)
  *
  * the recursive count returns
  *         the sum of the number of rows of all the subtables
  *         + the number of rows in the parent table
  */
 public function testCountRowsComplex()
 {
     $idcol = Row::COLUMNS;
     $idsubtable = Row::DATATABLE_ASSOCIATED;
     // table to go in the SUB table of RoW1
     $tableSubOfSubOfRow1 = new DataTable();
     $rows1sub = array(array($idcol => array('label' => 'google')), array($idcol => array('label' => 'google78')), array($idcol => array('label' => 'googlaegge')), array($idcol => array('label' => 'gogeoggle')), array($idcol => array('label' => 'goaegaegaogle')), array($idcol => array('label' => 'ask')), array($idcol => array('label' => '238975247578949')));
     $tableSubOfSubOfRow1->addRowsFromArray($rows1sub);
     // table to go in row1
     $tableSubOfRow1 = new DataTable();
     $rows1 = array(array($idcol => array('label' => 'google'), $idsubtable => $tableSubOfSubOfRow1), array($idcol => array('label' => 'ask')), array($idcol => array('label' => '238975247578949')));
     $tableSubOfRow1->addRowsFromArray($rows1);
     // table to go in row2
     $tableSubOfRow2 = new DataTable();
     $rows2 = array(array($idcol => array('label' => 'google')), array($idcol => array('label' => 'ask')), array($idcol => array('label' => '238975247578949')), array($idcol => array('label' => 'agaegaesk')), array($idcol => array('label' => '23g  8975247578949')));
     $tableSubOfRow2->addRowsFromArray($rows2);
     // main parent table
     $table = new DataTable();
     $rows = array(array($idcol => array('label' => 'row1')), array($idcol => array('label' => 'row2'), $idsubtable => $tableSubOfRow1), array($idcol => array('label' => 'row3'), $idsubtable => $tableSubOfRow2));
     $table->addRowsFromArray($rows);
     $this->assertEquals(3, $table->getRowsCount());
     $this->assertEquals(18, $table->getRowsCountRecursive());
 }
Пример #2
0
 private function rememberNumberOfSites()
 {
     $this->numSites = $this->sitesByGroup->getRowsCountRecursive();
 }
Пример #3
0
 public function search($pattern)
 {
     $this->nestedSearch($this->sitesByGroup, $pattern);
     $this->numSites = $this->sitesByGroup->getRowsCountRecursive();
 }