/** * {@inheritdoc} */ public function toArray() { if (null === $this->data) { $resultData = $this->datagrid->getData(); $this->data = $resultData['data']; } return $this->data; }
/** * @return ResultsObject */ protected function getGridData() { if (null !== $this->gridDataSource) { $this->grid->setDatasource(clone $this->gridDataSource); } else { $this->gridDataSource = clone $this->grid->getDatasource(); } $this->grid->getParameters()->set(PagerInterface::PAGER_ROOT_PARAM, [PagerInterface::PAGE_PARAM => $this->page, PagerInterface::PER_PAGE_PARAM => $this->pageSize]); return $this->grid->getData(); }
/** * Renders grid data * * @param DatagridInterface $grid * @return array */ public function getGridData(DatagridInterface $grid) { return $grid->getData()->toArray(); }
/** * Method detects type of report's chart 'label' field, and in case of datetime will check dates interval and * set proper type (time, day, date, month or year). Xaxis labels not taken into account - they will be rendered * automatically. Also chart dot labels may overlap if dates are close to each other. * * Should be refactored in scope of BAP-8294. * * @param DatagridInterface $datagrid * @param array $chartOptions * * @return array */ protected function processChartOptions(DatagridInterface $datagrid, array $chartOptions) { $labelFieldName = $chartOptions['data_schema']['label']; $labelFieldType = $datagrid->getConfig()->offsetGetByPath(sprintf('[columns][%s][frontend_type]', $labelFieldName)); /** @var DateHelper $dateTimeHelper */ $dateTimeHelper = $this->get('oro_dashboard.datetime.helper'); $dateTypes = [Type::DATETIME, Type::DATE, Type::DATETIMETZ]; if (in_array($labelFieldType, $dateTypes)) { $data = $datagrid->getData()->offsetGet('data'); $dates = array_map(function ($dataItem) use($labelFieldName) { return $dataItem[$labelFieldName]; }, $data); $minDate = new \DateTime(min($dates)); $maxDate = new \DateTime(max($dates)); $formatStrings = $dateTimeHelper->getFormatStrings($minDate, $maxDate); $chartOptions['data_schema']['label'] = ['field_name' => $chartOptions['data_schema']['label'], 'type' => $formatStrings['viewType']]; } return $chartOptions; }
/** * @return ResultsObject */ protected function getGridData() { $this->grid->getParameters()->set(PagerInterface::PAGER_ROOT_PARAM, [PagerInterface::PAGE_PARAM => $this->page, PagerInterface::PER_PAGE_PARAM => $this->pageSize]); return $this->grid->getData(); }