コード例 #1
0
 public function testBuild()
 {
     $expectedResult = ['count' => 'count(main_table.value)'];
     $this->requestBucket->expects($this->once())->method('getMetrics')->willReturn([$this->metric]);
     $this->metric->expects($this->once())->method('getType')->willReturn('count');
     $metrics = $this->metrics->build($this->requestBucket);
     $this->assertEquals($expectedResult, $metrics);
 }
コード例 #2
0
ファイル: Term.php プロジェクト: pradeep-wagento/magento2
 /**
  * {@inheritdoc}
  */
 public function build(DataProviderInterface $dataProvider, array $dimensions, RequestBucketInterface $bucket, Table $entityIdsTable)
 {
     $metrics = $this->metricsBuilder->build($bucket);
     $select = $dataProvider->getDataSet($bucket, $dimensions, $entityIdsTable);
     $select->columns($metrics);
     $select->group(RequestBucketInterface::FIELD_VALUE);
     return $dataProvider->execute($select);
 }
コード例 #3
0
ファイル: Range.php プロジェクト: pradeep-wagento/magento2
 /**
  * {@inheritdoc}
  */
 public function build(DataProviderInterface $dataProvider, array $dimensions, RequestBucketInterface $bucket, Table $entityIdsTable)
 {
     /** @var RangeBucket $bucket */
     $select = $dataProvider->getDataSet($bucket, $dimensions, $entityIdsTable);
     $metrics = $this->metricsBuilder->build($bucket);
     /** @var Select $fullQuery */
     $fullQuery = $this->connection->select();
     $fullQuery->from(['main_table' => $select], null);
     $fullQuery = $this->generateCase($fullQuery, $bucket->getRanges());
     $fullQuery->columns($metrics);
     $fullQuery->group(new \Zend_Db_Expr('1'));
     return $dataProvider->execute($fullQuery);
 }