Ejemplo n.º 1
0
 /**
  * Returns a DataTable that has the name '$name' from the current Archive.
  * If $idSubTable is specified, returns the subDataTable called '$name_$idSubTable'
  *
  * @param string $name
  * @param int $idSubTable optional id SubDataTable
  * @return Piwik_DataTable
  */
 public function getDataTable($name, $idSubTable = null)
 {
     if (!is_null($idSubTable)) {
         $name .= "_{$idSubTable}";
     }
     $data = $this->get($name, 'blob');
     $table = new Piwik_DataTable();
     if ($data !== false) {
         $table->loadFromSerialized($data);
     }
     if ($data === false && $idSubTable !== null) {
         throw new Exception("You are requesting a precise subTable but there is not such data in the Archive.");
     }
     return $table;
 }