예제 #1
0
 /**
  * {@inheritdoc}
  */
 public function getReport(ReportConfiguration $configuration)
 {
     $criteria = $this->getCriteria($configuration);
     $collection = $this->repository->matching($criteria);
     $report = new ReportRowCollection();
     $collection->map(function (ClientInterface $client) use($report) {
         $ordersTotal = $this->calculateOrdersAmountForClient($client);
         $identifier = $client->getFirstName() . ' ' . $client->getLastName();
         $report->add(new ReportRow($identifier, $ordersTotal));
     });
     return $report;
 }
예제 #2
0
 /**
  * {@inheritdoc}
  */
 public function getReport(ReportConfiguration $configuration)
 {
     $criteria = $this->getCriteria($configuration);
     $collection = $this->repository->matching($criteria);
     $report = new ReportRowCollection();
     $collection->map(function (OrderInterface $order) use($configuration, $report) {
         $date = $order->getCreatedAt()->format($configuration->getGroupByDateFormat());
         $amount = $this->convertAmount($order);
         $report->add(new ReportRow($date, $amount));
     });
     return $report;
 }