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


PHP DataTable::rebuildIndex方法代码示例

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


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

示例1: doFilterRecursiveDescend

 /**
  * Method for the recursive descend
  *
  * @param array $labelParts
  * @param DataTable $dataTable
  * @return Row|bool
  */
 private function doFilterRecursiveDescend($labelParts, $dataTable)
 {
     // we need to make sure to rebuild the index as some filters change the label column directly via
     // $row->setColumn('label', '') which would not be noticed in the label index otherwise.
     $dataTable->rebuildIndex();
     // search for the first part of the tree search
     $labelPart = array_shift($labelParts);
     $row = false;
     foreach ($this->getLabelVariations($labelPart) as $labelPart) {
         $row = $dataTable->getRowFromLabel($labelPart);
         if ($row !== false) {
             break;
         }
     }
     if ($row === false) {
         // not found
         return false;
     }
     // end of tree search reached
     if (count($labelParts) == 0) {
         return $row;
     }
     $subTable = $this->loadSubtable($dataTable, $row);
     if ($subTable === null) {
         // no more subtables but label parts left => no match found
         return false;
     }
     return $this->doFilterRecursiveDescend($labelParts, $subTable);
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:36,代码来源:LabelFilter.php

示例2: isEqual

 /**
  * Returns true if both DataTable instances are exactly the same.
  *
  * DataTables are equal if they have the same number of rows, if
  * each row has a label that exists in the other table, and if each row
  * is equal to the row in the other table with the same label. The order
  * of rows is not important.
  *
  * @param \Piwik\DataTable $table1
  * @param \Piwik\DataTable $table2
  * @return bool
  */
 public static function isEqual(DataTable $table1, DataTable $table2)
 {
     $table1->rebuildIndex();
     $table2->rebuildIndex();
     if ($table1->getRowsCount() != $table2->getRowsCount()) {
         return false;
     }
     $rows1 = $table1->getRows();
     foreach ($rows1 as $row1) {
         $row2 = $table2->getRowFromLabel($row1->getColumn('label'));
         if ($row2 === false || !Row::isEqual($row1, $row2)) {
             return false;
         }
     }
     return true;
 }
开发者ID:piwik,项目名称:piwik,代码行数:28,代码来源:DataTable.php


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