protected function finalizeConfiguration(
        string $code,
        array $dataGridConfiguration
    ): array {
        // Handle possible parent configuration @todo find a better way to do this
        if (isset($dataGridConfiguration['parent'])) {
            $parent = $dataGridConfiguration['parent'];
            if (empty($this->globalConfiguration['configurations'][$parent])) {
                throw new UnexpectedValueException("Unknown configuration {$parent}");
            }
            $parentConfig = $this->globalConfiguration['configurations'][$parent];
            $dataGridConfiguration = array_merge($parentConfig, $dataGridConfiguration);
        }
        unset($dataGridConfiguration['parent']);

        // Set default values from global configuration
        if (empty($dataGridConfiguration['form_theme'])) {
            $dataGridConfiguration['form_theme'] = $this->globalConfiguration['default_form_theme'];
        }
        if (empty($dataGridConfiguration['template'])) {
            $dataGridConfiguration['template'] = $this->globalConfiguration['default_datagrid_template'];
        }
        if (empty($dataGridConfiguration['column_value_renderer'])) {
            $dataGridConfiguration['column_value_renderer'] = $this->globalConfiguration['default_column_value_renderer'];
        }
        if (empty($dataGridConfiguration['column_label_renderer'])) {
            $dataGridConfiguration['column_label_renderer'] = $this->globalConfiguration['default_column_label_renderer'];
        }

        if (isset($dataGridConfiguration['query_handler'])) {
            // Allow either a service or a direct configuration for filters
            if (\is_array($dataGridConfiguration['query_handler'])) {
                $dataGridConfiguration['query_handler'] = $this->finalizeFilterConfiguration(
                    $code,
                    $dataGridConfiguration['query_handler']
                );
            } elseif (0 === strpos($dataGridConfiguration['query_handler'], '@')) {
                $dataGridConfiguration['query_handler'] = new Reference(
                    ltrim($dataGridConfiguration['query_handler'], '@')
                );
            } else {
                throw new UnexpectedValueException(
                    'query_handler option must be either a service or a valid filter configuration'
                );
            }
        }

        return $dataGridConfiguration;
    }
protected function finalizeConfiguration(
        string $code,
        array $dataGridConfiguration
    ): array {
        // Handle possible parent configuration @todo find a better way to do this
        if (isset($dataGridConfiguration['parent'])) {
            $parent = $dataGridConfiguration['parent'];
            if (empty($this->globalConfiguration['configurations'][$parent])) {
                throw new UnexpectedValueException("Unknown configuration {$parent}");
            }
            $parentConfig = $this->globalConfiguration['configurations'][$parent];
            $dataGridConfiguration = array_merge($parentConfig, $dataGridConfiguration);
        }
        unset($dataGridConfiguration['parent']);

        // Set default values from global configuration
        if (empty($dataGridConfiguration['form_theme'])) {
            $dataGridConfiguration['form_theme'] = $this->globalConfiguration['default_form_theme'];
        }
        if (empty($dataGridConfiguration['template'])) {
            $dataGridConfiguration['template'] = $this->globalConfiguration['default_datagrid_template'];
        }
        if (empty($dataGridConfiguration['column_value_renderer'])) {
            $dataGridConfiguration['column_value_renderer'] = $this->globalConfiguration['default_column_value_renderer'];
        }
        if (empty($dataGridConfiguration['column_label_renderer'])) {
            $dataGridConfiguration['column_label_renderer'] = $this->globalConfiguration['default_column_label_renderer'];
        }

        if (isset($dataGridConfiguration['query_handler'])) {
            // Allow either a service or a direct configuration for filters
            if (\is_array($dataGridConfiguration['query_handler'])) {
                $dataGridConfiguration['query_handler'] = $this->finalizeFilterConfiguration(
                    $code,
                    $dataGridConfiguration['query_handler']
                );
            } elseif (0 === strpos($dataGridConfiguration['query_handler'], '@')) {
                $dataGridConfiguration['query_handler'] = new Reference(
                    ltrim($dataGridConfiguration['query_handler'], '@')
                );
            } else {
                throw new UnexpectedValueException(
                    'query_handler option must be either a service or a valid filter configuration'
                );
            }
        }

        return $dataGridConfiguration;
    }
protected function finalizeConfiguration ( string $ code , array $ dataGridConfiguration ) : array { // Handle possible parent configuration @todo find a better way to do this if ( isset ( $ dataGridConfiguration [ 'parent' ] ) ) { $ parent = $ dataGridConfiguration [ 'parent' ] ; if ( empty ( $ this -> globalConfiguration [ 'configurations' ] [ $ parent ] ) ) { throw new UnexpectedValueException ( "Unknown configuration {$parent}" ) ; } $ parentConfig = $ this -> globalConfiguration [ 'configurations' ] [ $ parent ] ; $ dataGridConfiguration = array_merge ( $ parentConfig , $ dataGridConfiguration ) ; } unset ( $ dataGridConfiguration [ 'parent' ] ) ; // Set default values from global configuration if ( empty ( $ dataGridConfiguration [ 'form_theme' ] ) ) { $ dataGridConfiguration [ 'form_theme' ] = $ this -> globalConfiguration [ 'default_form_theme' ] ; } if ( empty ( $ dataGridConfiguration [ 'template' ] ) ) { $ dataGridConfiguration [ 'template' ] = $ this -> globalConfiguration [ 'default_datagrid_template' ] ; } if ( empty ( $ dataGridConfiguration [ 'column_value_renderer' ] ) ) { $ dataGridConfiguration [ 'column_value_renderer' ] = $ this -> globalConfiguration [ 'default_column_value_renderer' ] ; } if ( empty ( $ dataGridConfiguration [ 'column_label_renderer' ] ) ) { $ dataGridConfiguration [ 'column_label_renderer' ] = $ this -> globalConfiguration [ 'default_column_label_renderer' ] ; } if ( isset ( $ dataGridConfiguration [ 'query_handler' ] ) ) { // Allow either a service or a direct configuration for filters if ( \ is_array ( $ dataGridConfiguration [ 'query_handler' ] ) ) { $ dataGridConfiguration [ 'query_handler' ] = $ this -> finalizeFilterConfiguration ( $ code , $ dataGridConfiguration [ 'query_handler' ] ) ; } elseif ( 0 === strpos ( $ dataGridConfiguration [ 'query_handler' ] , '@' ) ) { $ dataGridConfiguration [ 'query_handler' ] = new Reference ( ltrim ( $ dataGridConfiguration [ 'query_handler' ] , '@' ) ) ; } else { throw new UnexpectedValueException ( 'query_handler option must be either a service or a valid filter configuration' ) ; } } return $ dataGridConfiguration ; }
Handle configuration parsing logic not handled by the semantic configuration definition

@param string $code
@param array  $dataGridConfiguration

@throws \Exception

@return array
Handle configuration parsing logic not handled by the semantic configuration definition