/**
  * {@inheritdoc}
  */
 public function processConfigs(DatagridConfiguration $config)
 {
     $fields = $this->getFields($config);
     foreach ($fields as $field) {
         $columnOptions = [];
         $this->prepareColumnOptions($field, $columnOptions);
         $this->datagridGuesser->setColumnOptions($config, $field->getFieldName(), $columnOptions);
     }
 }
 public function testSetColumnOptions()
 {
     $container = new ContainerBuilder();
     $datagridGuesser = new DatagridGuesser($container, []);
     $config = DatagridConfiguration::create([]);
     $columnOptions = [DatagridGuesser::FORMATTER => ['formatter_prop' => 'test'], DatagridGuesser::SORTER => ['sorter_prop' => 'test'], DatagridGuesser::FILTER => ['filter_prop' => 'test']];
     $datagridGuesser->setColumnOptions($config, 'testColumn', $columnOptions);
     $this->assertEquals(['columns' => ['testColumn' => ['formatter_prop' => 'test']], 'sorters' => ['columns' => ['testColumn' => ['sorter_prop' => 'test']]], 'filters' => ['columns' => ['testColumn' => ['filter_prop' => 'test']]]], $config->toArray());
 }
 /**
  * {@inheritdoc}
  */
 protected function addSelectColumn($entityClassName, $tableAlias, $fieldName, $columnExpr, $columnAlias, $columnLabel, $functionExpr, $functionReturnType, $isDistinct = false)
 {
     if ($isDistinct) {
         $columnExpr = 'DISTINCT ' . $columnExpr;
     }
     if ($functionExpr !== null) {
         $functionExpr = $this->prepareFunctionExpression($functionExpr, $tableAlias, $fieldName, $columnExpr, $columnAlias);
     }
     $this->selectColumns[] = sprintf('%s as %s', $functionExpr !== null ? $functionExpr : $columnExpr, $columnAlias);
     $fieldType = $functionReturnType;
     if ($fieldType === null) {
         $fieldType = $this->getFieldType($entityClassName, $fieldName);
     }
     $columnOptions = [DatagridGuesser::FORMATTER => ['label' => $columnLabel, 'translatable' => false], DatagridGuesser::SORTER => ['data_name' => $columnAlias], DatagridGuesser::FILTER => ['data_name' => $this->getFilterByExpr($entityClassName, $tableAlias, $fieldName, $columnAlias), 'translatable' => false]];
     if ($functionExpr !== null) {
         $columnOptions[DatagridGuesser::FILTER][FilterUtility::BY_HAVING_KEY] = true;
     }
     $this->datagridGuesser->applyColumnGuesses($entityClassName, $fieldName, $fieldType, $columnOptions);
     $this->datagridGuesser->setColumnOptions($this->config, $columnAlias, $columnOptions);
 }