Fill the property columns in a well format for the process method.

@param ColumnInterface[] $columnsArray The validated columns array.

@throws \Exception
512102
private function _prepareColumns(array $columnsArray)
	{
		if(count($columnsArray) === 0)
		{
			throw new \Exception('"column"-method of the statement have to invoked before!');
		}
		$columns = ' ';
		foreach($columnsArray as $column)
		{
			$columns .= $column->getExpression() . ', ';
		}
		$columns       = substr($columns, 0, strlen($columns) - 2);
		$this->columns = $columns . ' ';
	}
623309
public function setColumn(\Assurrussa\GridView\Interfaces\ColumnInterface $column): ColumnsInterface
    {
        $this->_columns[] = $column;

        return $this;
    }
778478
public function setProperties(array $properties = [])
    {
        foreach ($properties as $property => $value) {
            $method = 'set'.ucfirst($property);
            if (!method_exists($this, $method)) {
                throw new \RuntimeException("Undefined method $method.");
            }

            if (!in_array($property, $this->validProperties)) {
                throw new \Exception('You are trying to set invalid properties. Please check valid properties.');
            }

            $this->{$method}($value);
        }
    }
309307
public function select($columns = [])
    {
        $expr = new ColumnExpression($this->sql);

        if ($columns instanceof Closure) {
            $columns($expr);
        } else {
            if (!is_array($columns)) {
                $columns = [$columns];
            }
            $expr->columns($columns);
        }
    }
432364
public function setColumns($cols) {
		if(!is_array($cols)) {
			throw new Exception("BootstrapOptionsetField::setColumns must be passed an array.");
		}

		$allowed_keys = array('lg','md','sm','xs');
		$diff = array_diff($allowed_keys, array_keys($cols));
		if(!empty($diff)) {
			throw new Exception("BootstrapOptionsetField::setColumns must be passed an array with keys " . implode(', ', $allowed_keys));
		}

		$this->columnCounts = $cols;

		$maxSpan = max(array_values($this->columnCounts));
		$minSpan = min(array_values($this->columnCounts));
		$this->numberOfColumns = ceil($maxSpan/$minSpan);

		return $this->owner;
	}
1200334
public function setColumns(array $columns)
    {
        $this->mappingColumns = null;
        $this->columns = array_values($columns);

        return $this;
    }
769049
public function setColumns(array $columns): self
    {
        foreach ($columns as $column => list($type, $size)) {
            list($type, $size) = $this->validateColumn($type, $size);
            $columns[$column] = [$type, $size];
        }
        $this->columns = $columns;
        return $this;
    }
1179166
public function checkMandatoryColumns(array $data)
    {
        $diff = array_diff($this->mandatoryColumns, array_keys($data));

        if (\count($diff) > 0) {
            throw new \UnexpectedValueException(
                Translator::getInstance()->trans(
                    'The following columns are missing: %columns',
                    [
                        '%columns' => implode(', ', $diff)
                    ]
                )
            );
        }
    }
853678
public function setUnusedElements(array &$fieldArray)
    {
        $changedGridElements = [];
        $changedElements = [];
        $changedSubPageElements = [];

        if ($this->getTable() === 'tt_content') {
            $changedGridElements[$this->getContentUid()] = true;
            $childElementsInUnavailableColumns = [];
            $childElementsInAvailableColumns = [];
            $availableColumns = $this->getAvailableColumns($fieldArray['tx_gridelements_backend_layout'], 'tt_content');
            if (!empty($availableColumns) || $availableColumns === '0') {
                $availableColumns = GeneralUtility::intExplode(',', $availableColumns);
                $queryBuilder = $this->getQueryBuilder();
                $childElementsInUnavailableColumnsQuery = $queryBuilder
                    ->select('uid')
                    ->from('tt_content')
                    ->where(
                        $queryBuilder->expr()->andX(
                            $queryBuilder->expr()->gt('tx_gridelements_container', 0),
                            $queryBuilder->expr()->eq(
                                'tx_gridelements_container',
                                $queryBuilder->createNamedParameter((int)$this->getContentUid(), \PDO::PARAM_INT)
                            ),
                            $queryBuilder->expr()->notIn(
                                'tx_gridelements_columns',
                                $queryBuilder->createNamedParameter($availableColumns, Connection::PARAM_INT_ARRAY)
                            )
                        )
                    )
                    ->execute();
                $childElementsInUnavailableColumns = [];
                while ($childElementInUnavailableColumns = $childElementsInUnavailableColumnsQuery->fetch()) {
                    $childElementsInUnavailableColumns[] = $childElementInUnavailableColumns['uid'];
                }
                if (!empty($childElementsInUnavailableColumns)) {
                    $queryBuilder
                        ->update('tt_content')
                        ->where(
                            $queryBuilder->expr()->in(
                                'uid',
                                $queryBuilder->createNamedParameter(
                                    $childElementsInUnavailableColumns,
                                    Connection::PARAM_INT_ARRAY
                                )
                            )
                        )
                        ->set('colPos', -2)
                        ->set('backupColPos', -1)
                        ->execute();
                    array_flip($childElementsInUnavailableColumns);
                }

                $queryBuilder = $this->getQueryBuilder();
                $childElementsInAvailableColumnsQuery = $queryBuilder
                    ->select('uid')
                    ->from('tt_content')
                    ->where(
                        $queryBuilder->expr()->andX(
                            $queryBuilder->expr()->gt('tx_gridelements_container', 0),
                            $queryBuilder->expr()->eq(
                                'tx_gridelements_container',
                                $queryBuilder->createNamedParameter((int)$this->getContentUid(), \PDO::PARAM_INT)
                            ),
                            $queryBuilder->expr()->in(
                                'tx_gridelements_columns',
                                $queryBuilder->createNamedParameter($availableColumns, Connection::PARAM_INT_ARRAY)
                            )
                        )
                    )
                    ->execute();
                $childElementsInAvailableColumns = [];
                while ($childElementInAvailableColumns = $childElementsInAvailableColumnsQuery->fetch()) {
                    $childElementsInAvailableColumns[] = $childElementInAvailableColumns['uid'];
                }
                if (!empty($childElementsInAvailableColumns)) {
                    $queryBuilder
                        ->update('tt_content')
                        ->where(
                            $queryBuilder->expr()->in(
                                'uid',
                                $queryBuilder->createNamedParameter(
                                    $childElementsInAvailableColumns,
                                    Connection::PARAM_INT_ARRAY
                                )
                            )
                        )
                        ->set('colPos', -1)
                        ->set('backupColPos', -2)
                        ->execute();
                    array_flip($childElementsInAvailableColumns);
                }
            }
            $changedGridElements = $changedGridElements + $childElementsInUnavailableColumns + $childElementsInAvailableColumns;
        }

        if ($this->getTable() === 'pages') {
            $backendLayoutUid = 0;
            $backendLayoutNextLevelUid = 0;
            $rootline = BackendUtility::BEgetRootLine($this->getPageUid());
            for ($i = count($rootline); $i > 0; $i--) {
                $page = BackendUtility::getRecord(
                    'pages',
                    (int)$rootline[$i]['uid'],
                    'uid,backend_layout,backend_layout_next_level'
                );
                $selectedBackendLayoutNextLevel = (int)$page['backend_layout_next_level'];
                if ($page['uid'] === $this->getPageUid()) {
                    if ($fieldArray['backend_layout_next_level'] !== 0) {
                        // Backend layout for sub pages of the current page is set
                        $backendLayoutNextLevelUid = (int)$fieldArray['backend_layout_next_level'];
                    }
                    if ($fieldArray['backend_layout'] !== 0) {
                        // Backend layout for current page is set
                        $backendLayoutUid = $fieldArray['backend_layout'];
                        break;
                    }
                } else {
                    if ($selectedBackendLayoutNextLevel === -1 && $page['uid'] !== $this->getPageUid()) {
                        // Some previous page in our rootline sets layout_next to "None"
                        break;
                    }
                    if ($selectedBackendLayoutNextLevel > 0 && $page['uid'] !== $this->getPageUid()) {
                        // Some previous page in our rootline sets some backend_layout, use it
                        $backendLayoutUid = $selectedBackendLayoutNextLevel;
                        break;
                    }
                }
            }

            if (isset($fieldArray['backend_layout'])) {
                $availableColumns = $this->getAvailableColumns($backendLayoutUid, 'pages', $this->getPageUid());
                $availableColumns = GeneralUtility::intExplode(',', $availableColumns);
                $queryBuilder = $this->getQueryBuilder();
                $elementsInUnavailableColumnsQuery = $queryBuilder
                    ->select('uid')
                    ->from('tt_content')
                    ->where(
                        $queryBuilder->expr()->andX(
                            $queryBuilder->expr()->eq(
                                'pid',
                                $queryBuilder->createNamedParameter((int)$this->getPageUid(), \PDO::PARAM_INT)
                            ),
                            $queryBuilder->expr()->notIn(
                                'colPos',
                                $queryBuilder->createNamedParameter($availableColumns, Connection::PARAM_INT_ARRAY)
                            )
                        )
                    )
                    ->execute();
                $elementsInUnavailableColumns = [];
                while ($elementInUnavailableColumns = $elementsInUnavailableColumnsQuery->fetch()) {
                    $elementsInUnavailableColumns[] = $elementInUnavailableColumns['uid'];
                }
                if (!empty($elementsInUnavailableColumns)) {
                    $queryBuilder
                        ->update('tt_content')
                        ->where(
                            $queryBuilder->expr()->in(
                                'uid',
                                $queryBuilder->createNamedParameter(
                                    $elementsInUnavailableColumns,
                                    Connection::PARAM_INT_ARRAY
                                )
                            )
                        )
                        ->set('backupColPos', $queryBuilder->quoteIdentifier('colPos'), false)
                        ->set('colPos', -2)
                        ->execute();
                    array_flip($elementsInUnavailableColumns);
                }

                $queryBuilder = $this->getQueryBuilder();
                $elementsInAvailableColumnsQuery = $queryBuilder
                    ->select('uid')
                    ->from('tt_content')
                    ->where(
                        $queryBuilder->expr()->andX(
                            $queryBuilder->expr()->eq(
                                'pid',
                                $queryBuilder->createNamedParameter((int)$this->getPageUid(), \PDO::PARAM_INT)
                            ),
                            $queryBuilder->expr()->neq(
                                'backupColPos',
                                $queryBuilder->createNamedParameter(-2, \PDO::PARAM_INT)
                            ),
                            $queryBuilder->expr()->in(
                                'backupColPos',
                                $queryBuilder->createNamedParameter($availableColumns, Connection::PARAM_INT_ARRAY)
                            )
                        )
                    )
                    ->execute();
                $elementsInAvailableColumns = [];
                while ($elementInAvailableColumns = $elementsInAvailableColumnsQuery->fetch()) {
                    $elementsInAvailableColumns[] = $elementInAvailableColumns['uid'];
                }
                if (!empty($elementsInAvailableColumns)) {
                    $queryBuilder
                        ->update('tt_content')
                        ->where(
                            $queryBuilder->expr()->in(
                                'uid',
                                $queryBuilder->createNamedParameter(
                                    $elementsInAvailableColumns,
                                    Connection::PARAM_INT_ARRAY
                                )
                            )
                        )
                        ->set('colPos', $queryBuilder->quoteIdentifier('backupColPos'), false)
                        ->set('backupColPos', -2)
                        ->execute();
                    array_flip($elementsInAvailableColumns);
                }
                $changedElements = $elementsInUnavailableColumns + $elementsInAvailableColumns;
            }

            if (isset($fieldArray['backend_layout_next_level'])) {
                $backendLayoutUid = $backendLayoutNextLevelUid ? $backendLayoutNextLevelUid : $backendLayoutUid;
                $subPages = [];
                $this->getSubPagesRecursively($this->getPageUid(), $subPages);
                if (!empty($subPages)) {
                    $changedSubPageElements = [];
                    foreach ($subPages as $page) {
                        $availableColumns = $this->getAvailableColumns($backendLayoutUid, 'pages', $page['uid']);
                        $availableColumns = GeneralUtility::intExplode(',', $availableColumns);
                        $queryBuilder = $this->getQueryBuilder();
                        $subPageElementsInUnavailableColumnsQuery = $queryBuilder
                            ->select('uid')
                            ->from('tt_content')
                            ->where(
                                $queryBuilder->expr()->andX(
                                    $queryBuilder->expr()->eq(
                                        'pid',
                                        $queryBuilder->createNamedParameter((int)$page['uid'], \PDO::PARAM_INT)
                                    ),
                                    $queryBuilder->expr()->notIn(
                                        'colPos',
                                        $queryBuilder->createNamedParameter(
                                            $availableColumns,
                                            Connection::PARAM_INT_ARRAY
                                        )
                                    )
                                )
                            )
                            ->execute();
                        $subPageElementsInUnavailableColumns = [];
                        while ($subPageElementInUnavailableColumns = $subPageElementsInUnavailableColumnsQuery->fetch()) {
                            $subPageElementsInUnavailableColumns[] = $subPageElementInUnavailableColumns['uid'];
                        }
                        if (!empty($subPageElementsInUnavailableColumns)) {
                            $queryBuilder
                                ->update('tt_content')
                                ->where(
                                    $queryBuilder->expr()->in(
                                        'uid',
                                        $queryBuilder->createNamedParameter(
                                            $subPageElementsInUnavailableColumns,
                                            Connection::PARAM_INT_ARRAY
                                        )
                                    )
                                )
                                ->set('backupColPos', $queryBuilder->quoteIdentifier('colPos'), false)
                                ->set('colPos', -2)
                                ->execute();
                            array_flip($subPageElementsInUnavailableColumns);
                        }

                        $queryBuilder = $this->getQueryBuilder();
                        $subPageElementsInAvailableColumnsQuery = $queryBuilder
                            ->select('uid')
                            ->from('tt_content')
                            ->where(
                                $queryBuilder->expr()->andX(
                                    $queryBuilder->expr()->eq(
                                        'pid',
                                        $queryBuilder->createNamedParameter((int)$page['uid'], \PDO::PARAM_INT)
                                    ),
                                    $queryBuilder->expr()->neq(
                                        'backupColPos',
                                        $queryBuilder->createNamedParameter(-2, \PDO::PARAM_INT)
                                    ),
                                    $queryBuilder->expr()->in(
                                        'backupColPos',
                                        $queryBuilder->createNamedParameter(
                                            $availableColumns,
                                            Connection::PARAM_INT_ARRAY
                                        )
                                    )
                                )
                            )
                            ->execute();
                        $subPageElementsInAvailableColumns = [];
                        while ($subPageElementInAvailableColumns = $subPageElementsInAvailableColumnsQuery->fetch()) {
                            $subPageElementsInAvailableColumns[] = $subPageElementInAvailableColumns['uid'];
                        }
                        if (!empty($subPageElementsInAvailableColumns)) {
                            $queryBuilder
                                ->update('tt_content')
                                ->where(
                                    $queryBuilder->expr()->in(
                                        'uid',
                                        $queryBuilder->createNamedParameter(
                                            $subPageElementsInAvailableColumns,
                                            Connection::PARAM_INT_ARRAY
                                        )
                                    )
                                )
                                ->set('colPos', $queryBuilder->quoteIdentifier('backupColPos'), false)
                                ->set('backupColPos', -2)
                                ->execute();
                            array_flip($subPageElementsInAvailableColumns);
                        }

                        $changedPageElements = $subPageElementsInUnavailableColumns + $subPageElementsInAvailableColumns;
                        $changedSubPageElements = $changedSubPageElements + $changedPageElements;
                    }
                }
            }
        }

        $changedElementUids = $changedGridElements + $changedElements + $changedSubPageElements;
        if (!empty($changedElementUids)) {
            foreach ($changedElementUids as $uid => $value) {
                $this->dataHandler->updateRefIndex('tt_content', $uid);
            }
        }
    }
1233653
protected function generateDocBlock(array $columns): void
  {
    $this->codeStore->append('/**');
    $this->codeStore->append(' * @todo describe routine', false);
    $this->codeStore->append(' * ', false);

    $padding = $this->getMaxColumnLength($columns);
    $format  = sprintf(' * @param p_%%-%ds @todo describe parameter', $padding);
    foreach ($columns as $column)
    {
      $this->codeStore->append(sprintf($format, $column['column_name']), false);
    }

    $this->codeStore->append(' */', false);
  }
680055
public function setColumns($columns)
    {
        $columns = is_array($columns) ? $columns : func_get_args();

        if (count($columns) > 0) {
            $this->columns = implode(', ', $columns);
        }
    }
1062144
public function formatRow()
    {
        // execute CompleteLister row formating
        parent::formatRow();

        if (empty($this->columns)) {
            throw $this->exception('No columns defined for grid');
        }

        foreach ($this->columns as $field => $column) {
            if ((is_array($this->current_row) || $this->current_row instanceof ArrayAccess)
                && array_key_exists($field, $this->current_row)
            ) {
                $this->current_row[$field.'_original'] = $this->current_row[$field];
            }

            // if model field has listData structure, then get value instead of key
            if ($this->model && $f = $this->model->hasElement($field)) {
                $v = $this->current_row[$field];

                if ($this->model instanceof \atk4\data\Model) {
                    /** @type \atk4\data\Field $f */
                    if (isset($f->enum) && $values = $f->enum) {
                        $this->current_row[$field] = isset($f->ui['valueList'][$v])
                            ? $f->ui['valueList'][$v]
                            : $values[$v];
                    }
                } else {
                    /** @type Field $f */
                    if ($f->type() !== 'boolean' && $values = $f->listData()) {
                        $this->current_row[$field] = $values[$v];
                    }
                }
            }

            // process formatters
            $this->executeFormatters($field, $column, 'format_');

            // setting cell parameters (tdparam)
            $this->applyTDParams($field);
        }
    }
321035
public function setColumns(array $columns)
    {
        $useColumns = [];

        foreach ($columns as $col) {
            $col = $this->createColumn($col);
            $useColumns[$col->getUniqueId()] = $col;
        }

        $this->columns = $useColumns;
    }
618796
public function setColumnHeaders(array $columnHeaders)
    {
        $this->columnHeaders = array_count_values($columnHeaders);
        $this->headersCount = count($columnHeaders);
    }
739766
public function columns($columns)
    {
        if( is_array($columns) ||
            is_string($columns) ||
            $columns instanceof Expression ) {
            $this->columns = $columns;
        } else {
            throw new InvalidArgumentException('Invalid columns parameter');
        }
        return $this;
    }
1326560
protected function groupBy($columnname_or_columnarray) {
        if (!is_array($columnname_or_columnarray)) {
            $columnname_or_columnarray = [$columnname_or_columnarray];
        }
        $this->query->setGroupBy($columnname_or_columnarray);
        return $this;
    }
787804
public function setColumns(array $columns)
    {
        foreach ($columns as $id => $params) {
            if (!is_string($id) || strlen($id) < 1)
                throw new \Exception("Column ID should be a non-empty string");
            if (!isset($params['title']))
                throw new \Exception("No 'title' param for ID $id");
            if (!isset($params['type']))
                throw new \Exception("No 'type' param for ID $id");
            if (!in_array($params['type'], self::getAvailableTypes()))
                throw new \Exception("Unknown type '" . $params['type'] . "' for ID $id");
            if (!isset($params['filters']))
                throw new \Exception("No 'filters' param for ID $id");
            if (!isset($params['sortable']))
                throw new \Exception("No 'sortable' param for ID $id");
            if (!isset($params['visible']))
                throw new \Exception("No 'visible' param for ID $id");

            foreach ($params['filters'] as $filter) {
                if (!in_array($filter, self::getAvailableFilters()))
                    throw new \Exception("Unknown filter: $filter");
            }
        }

        $this->columns = $columns;
        return $this;
    }