本文整理汇总了PHP中Piwik\DataTable\Row::sumRowMetadata方法的典型用法代码示例。如果您正苦于以下问题:PHP Row::sumRowMetadata方法的具体用法?PHP Row::sumRowMetadata怎么用?PHP Row::sumRowMetadata使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\DataTable\Row
的用法示例。
在下文中一共展示了Row::sumRowMetadata方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_sumRowMetadata_uniquearraymergeShouldUseArrayFromThisRow_IfNoMetadataForOtherRowSpecified
public function test_sumRowMetadata_uniquearraymergeShouldUseArrayFromThisRow_IfNoMetadataForOtherRowSpecified()
{
$row = $this->getTestRowWithNoSubDataTable();
$arrayValue = array(array('test' => 3, 'value' => 3), array('test' => 2, 'value' => 2));
$this->row->setMetadata('my_array', $arrayValue);
$aggregations = array('my_array' => 'uniquearraymerge');
$this->row->sumRowMetadata($row, $aggregations);
$this->assertSame(array('my_array' => $arrayValue), $this->row->getMetadata());
}
示例2: testSumRowMetadata_CustomAggregationOperation
public function testSumRowMetadata_CustomAggregationOperation()
{
$metadata1 = array('mytest' => 'value1');
$metadata2 = array('mytest' => 'value2');
$self = $this;
$row1 = new Row(array(Row::COLUMNS => array('test_int' => 145), Row::METADATA => $metadata1));
$finalRow = new Row(array(Row::COLUMNS => array('test_int' => 5), Row::METADATA => $metadata2));
$finalRow->sumRowMetadata($row1, array('mytest' => function ($thisValue, $otherValue, $thisRow, $otherRow) use($self, $row1, $finalRow) {
$self->assertEquals('value2', $thisValue);
$self->assertEquals('value1', $otherValue);
$self->assertSame($thisRow, $finalRow);
$self->assertSame($otherRow, $row1);
if (!is_array($thisValue)) {
$thisValue = array($thisValue);
}
$thisValue[] = $otherValue;
return $thisValue;
}));
$this->assertEquals(array('value2', 'value1'), $finalRow->getMetadata('mytest'));
}