public __construct ( array $row = [] ) | ||
$row | array | An array with the following structure: array( Row::COLUMNS => array('label' => 'Piwik', 'column1' => 42, 'visits' => 657, 'time_spent' => 155744), Row::METADATA => array('logo' => 'test.png'), Row::DATATABLE_ASSOCIATED => $subtable // DataTable object // (but in the row only the ID will be stored) ) |
public function __construct($row = array())
{
if (isset($row[self::COLUMNS])) {
$this->exchangeArray($row[self::COLUMNS]);
}
if (isset($row[self::METADATA])) {
$this->metadata = $row[self::METADATA];
}
if (isset($row[self::DATATABLE_ASSOCIATED])) {
if ($row[self::DATATABLE_ASSOCIATED] instanceof DataTable) {
$this->setSubtable($row[self::DATATABLE_ASSOCIATED]);
} else {
$this->subtableId = $row[self::DATATABLE_ASSOCIATED];
}
}
}
/** * Constructor. * * @param DataTable|null $subTable The subtable of this row. This parameter is mostly for * convenience. If set, its rows will be summed to this one, * but it will not be set as this row's subtable (so * getSubtable() will return false). */ public function __construct($subTable = null) { parent::__construct(); if ($subTable !== null) { $this->sumTable($subTable); } }