Piwik\Plugin\Report::fetchSubtable PHP Method

fetchSubtable() public method

Fetches a subtable for the report represented by this instance.
public fetchSubtable ( integer $idSubtable, array $paramOverride = [] ) : DataTable
$idSubtable integer The subtable ID.
$paramOverride array Query parameter overrides.
return Piwik\DataTable
    public function fetchSubtable($idSubtable, $paramOverride = array())
    {
        $paramOverride = array('idSubtable' => $idSubtable) + $paramOverride;
        list($module, $action) = $this->getSubtableApiMethod();
        return Request::processRequest($module . '.' . $action, $paramOverride);
    }

Usage Example

Example #1
0
 private function loadSubtable(DataTable $table, Row $row)
 {
     $idSubtable = $row->getIdSubDataTable();
     if ($idSubtable === null) {
         return null;
     }
     $subtable = $row->getSubtable();
     if (!$subtable) {
         $subtable = $this->thisReport->fetchSubtable($idSubtable, $this->getRequestParamOverride($table));
     }
     if (!$subtable) {
         // sanity check
         throw new Exception("Unexpected error: could not load subtable '{$idSubtable}'.");
     }
     return $subtable;
 }