/** * {@inheritDoc} */ public function getDatagridByRequestParams($name, array $additionalParameters = []) { $gridScope = $this->nameStrategy->parseGridScope($name); if (!$gridScope) { // In case if grid has scope in config we should use it to get grid parameters properly $configuration = $this->getConfigurationForGrid($name); $scope = $configuration->offsetGetOr('scope'); if ($scope) { $name = $this->nameStrategy->buildGridFullName($name, $scope); } } $uniqueName = $this->getDatagridUniqueName($name); $parameters = $this->parametersFactory->createParameters($uniqueName); /** * In case of custom relation - $gridScope will be present. * So we need to check for additional parameters (pager, sorter, etc.) by gridName (without scope). * E.g. 'uniqueName' can be like 'entity-relation-grid:OroAcme_Bundle_AcmeBundle_Entity_AcmeEntit-relOneToMany' * so parameters by 'uniqueName' will contain 'class_name', 'field_name', 'id' * and parameters by 'gridName' (entity-relation-grid) will contain '_pager', '_sort_by', etc. * In such cases we'll merge them together, otherwise pagination and sorters will not work. */ if ($gridScope) { $gridName = $this->nameStrategy->parseGridName($name); $additional = $this->parametersFactory->createParameters($gridName)->all(); if ($additional) { $additionalParameters = array_merge($additionalParameters, $additional); } } $parameters->add($additionalParameters); return $this->getDatagrid($name, $parameters); }
/** * {@inheritdoc} */ public function buildView(BlockView $view, BlockInterface $block, array $options) { $view->vars['grid_name'] = $options['grid_name']; $view->vars['grid_parameters'] = $options['grid_parameters']; if (!empty($options['grid_scope'])) { $view->vars['grid_scope'] = $options['grid_scope']; $view->vars['grid_full_name'] = $this->nameStrategy->buildGridFullName($view->vars['grid_name'], $view->vars['grid_scope']); } else { $view->vars['grid_full_name'] = $view->vars['grid_name']; } }
/** * {@inheritDoc} */ public function getDatagridByRequestParams($name, array $additionalParameters = []) { $gridScope = $this->nameStrategy->parseGridScope($name); if (!$gridScope) { // In case if grid has scope in config we should use it to get grid parameters properly $configuration = $this->getConfigurationForGrid($name); $scope = $configuration->offsetGetOr('scope'); if ($scope) { $name = $this->nameStrategy->buildGridFullName($name, $scope); } } $parameters = $this->parametersFactory->createParameters($name); $parameters->add($additionalParameters); return $this->getDatagrid($name, $parameters); }
/** * @param DatagridInterface $grid * @param array $params * @return string */ protected function generateUrl(DatagridInterface $grid, $params) { $gridFullName = $this->nameStrategy->buildGridFullName($grid->getName(), $grid->getScope()); return $this->router->generate(self::ROUTE, ['gridName' => $gridFullName, $gridFullName => $params]); }