/**
  * @param ReportWizardForm $formModel
  */
 protected function setCommonAttributes(ReportWizardForm $formModel)
 {
     $formModel->id = $this->report->getId();
     $formModel->description = $this->report->getDescription();
     $formModel->moduleClassName = $this->report->getModuleClassName();
     if ($this->report->getOwner()->id > 0) {
         $formModel->ownerId = (int) $this->report->getOwner()->id;
         $formModel->ownerName = strval($this->report->getOwner());
     }
     $formModel->name = $this->report->getName();
     $formModel->type = $this->report->getType();
     $formModel->filtersStructure = $this->report->getFiltersStructure();
     $formModel->currencyConversionType = $this->report->getCurrencyConversionType();
     $formModel->spotConversionCurrencyCode = $this->report->getSpotConversionCurrencyCode();
     if ($this->report->isNew()) {
         $formModel->setIsNew();
     }
     $formModel->setExplicitReadWriteModelPermissions($this->report->getExplicitReadWriteModelPermissions());
     $formModel->filters = $this->report->getFilters();
     $formModel->orderBys = $this->report->getOrderBys();
     $formModel->groupBys = $this->report->getGroupBys();
     $formModel->displayAttributes = $this->report->getDisplayAttributes();
     $formModel->drillDownDisplayAttributes = $this->report->getDrillDownDisplayAttributes();
     $formModel->chart = $this->report->getChart();
 }
 /**
  * @param $data
  * @return array
  */
 protected function formatData($data)
 {
     if (!$this->isStacked()) {
         return $data;
     }
     foreach ($this->secondSeriesValueData as $secondSeriesKey) {
         foreach ($data as $firstSeriesDataKey => $firstSeriesData) {
             if (isset($firstSeriesData[self::resolveFirstSeriesValueName($secondSeriesKey)]) && !isset($firstSeriesData[self::resolveFirstSeriesFormattedValueName($secondSeriesKey)])) {
                 $value = $firstSeriesData[self::resolveFirstSeriesValueName($secondSeriesKey)];
                 $displayAttribute = $this->report->getDisplayAttributeByAttribute($this->report->getChart()->firstRange);
                 $data[$firstSeriesDataKey][self::resolveFirstSeriesFormattedValueName($secondSeriesKey)] = $this->formatValue($displayAttribute, $value);
             }
             if (isset($firstSeriesData[self::resolveSecondSeriesValueName($secondSeriesKey)]) && !isset($firstSeriesData[self::resolveSecondSeriesFormattedValueName($secondSeriesKey)])) {
                 $value = $firstSeriesData[self::resolveSecondSeriesValueName($secondSeriesKey)];
                 $displayAttribute = $this->report->getDisplayAttributeByAttribute($this->report->getChart()->secondRange);
                 $data[$firstSeriesDataKey][self::resolveSecondSeriesFormattedValueName($secondSeriesKey)] = $this->formatValue($displayAttribute, $value);
             }
         }
     }
     return $data;
 }
 /**
  * @param Report $report
  * @param SavedReport$savedReport
  */
 public static function resolveReportToSavedReport(Report $report, SavedReport $savedReport)
 {
     $savedReport->description = $report->getDescription();
     $savedReport->moduleClassName = $report->getModuleClassName();
     $savedReport->name = $report->getName();
     $savedReport->owner = $report->getOwner();
     $savedReport->type = $report->getType();
     $data = array();
     $data['filtersStructure'] = $report->getFiltersStructure();
     $data['currencyConversionType'] = $report->getCurrencyConversionType();
     $data['spotConversionCurrencyCode'] = $report->getSpotConversionCurrencyCode();
     $data[ComponentForReportForm::TYPE_FILTERS] = self::makeArrayFromComponentFormsAttributesData($report->getFilters());
     $data[ComponentForReportForm::TYPE_ORDER_BYS] = self::makeArrayFromComponentFormsAttributesData($report->getOrderBys());
     $data[ComponentForReportForm::TYPE_GROUP_BYS] = self::makeArrayFromComponentFormsAttributesData($report->getGroupBys());
     $data[ComponentForReportForm::TYPE_DISPLAY_ATTRIBUTES] = self::makeArrayFromComponentFormsAttributesData($report->getDisplayAttributes());
     $data[ComponentForReportForm::TYPE_DRILL_DOWN_DISPLAY_ATTRIBUTES] = self::makeArrayFromComponentFormsAttributesData($report->getDrillDownDisplayAttributes());
     if ($report->getChart()->type != null) {
         $data['chart'] = self::makeArrayFromChartForReportFormAttributesData($report->getChart());
     }
     $savedReport->serializedData = serialize($data);
 }