Creates new column instance.

@param string $columnName The name of the column.
@param bool   $withForms  If true, add column form configuration.

@return Column
965622
protected function createColumn($columnName, $withForms = false)
    {
        $column = new $this->columnClass($columnName, array(
            /* used for more verbose error messages */
            'builder' => $this->getYamlKey(),
            'generator' => $this->getBaseGeneratorName(),
        ));

        //Set the user parameters
        $this->setUserColumnConfiguration($column);

        $column->setDbType($this->getFieldOption(
            $column,
            'dbType',
            $this->getFieldGuesser()->getDbType(
                $this->getVariable('model'),
                $columnName
            )
        ));

        $column->setManyToMany($this->getFieldGuesser()->getManyToMany($this->getVariable('model'), $columnName));

        $column->setSortType($this->getFieldGuesser()->getSortType($column->getDbType()));

        $column->setPrimaryKey($this->getFieldOption(
            $column,
            'primaryKey',
            $this->getFieldGuesser()->getPrimaryKeyFor(
                $this->getVariable('model'),
                $columnName
            )
        ));

        if ($withForms) {
            $column->setFormType($this->getFieldOption(
                $column,
                'formType',
                $this->getFieldGuesser()->getFormType(
                    $column->getDbType(),
                    $this->getVariable('model'),
                    $columnName
                )
            ));

            // We don't use $column->getDbType because filtered column
            // might be on a field from an association. So we need to
            // resolve the filtered field dbType (and not the column
            // one).
            $filteredFieldDbType = $this->getFieldGuesser()->getDbType(
                $this->getVariable('model'),
                $column->getFilterOn()
            );

            $column->setFilterType($this->getFieldOption(
                $column,
                'filterType',
                $this->getFieldGuesser()->getFilterType(
                    $filteredFieldDbType,
                    $this->getVariable('model'),
                    $column->getFilterOn()
                )
            ));

            if ($this->getYamlKey() === 'list') {
                // Filters
                $column->setFilterOptions($this->getFieldOption(
                    $column,
                    'filterOptions',
                    $this->getFieldOption(
                        $column,
                        'formOptions',
                        $this->getFieldGuesser()->getFilterOptions(
                            $column->getFilterType(),
                            $filteredFieldDbType,
                            $this->getVariable('model'),
                            $column->getFilterOn()
                        )
                    )
                ));
            } else {
                $column->setFormOptions($this->getFieldOption(
                    $column,
                    'formOptions',
                    $this->getFieldGuesser()->getFormOptions(
                        $column->getFormType(),
                        $column->getDbType(),
                        $this->getVariable('model'),
                        $columnName
                    )
                ));
            }

            $fields = $this->getVariable('fields', array());
            $fieldOptions = is_array($fields) && array_key_exists($column->getName(), $fields)
                ? $fields[$column->getName()]
                : array();

            if (array_key_exists('addFormOptions', $fieldOptions)) {
                $column->setAddFormOptions($fieldOptions['addFormOptions']);
            }

            if (array_key_exists('addFilterOptions', $fieldOptions)) {
                $column->setAddFilterOptions($fieldOptions['addFilterOptions']);
            } elseif (array_key_exists('addFormOptions', $fieldOptions)) {
                $column->setAddFilterOptions($fieldOptions['addFormOptions']);
            }
        }

        return $column;
    }
1288681
public function is(string $columnName)
    {
        $this->addCondition('AND', $this->dialect()->quoteName($columnName) . ' = 1');

        return $this;
    }
816893
public function withParentIdAs(string $columnName)
    {
        call_user_func($this->callback, function ($idString, Table $parentTable) use ($columnName) {
            /** @var IEntityMapper $mapper */
            $mapper = call_user_func($this->mapperLoader);

            $mapper->addForeignKey(ForeignKey::createWithNamingConvention(
                $mapper->getPrimaryTableName(),
                [$columnName],
                $parentTable->getName(),
                [$parentTable->getPrimaryKeyColumnName()],
                $this->identifying
                    ? ForeignKeyMode::CASCADE
                    : ForeignKeyMode::SET_NULL,
                ForeignKeyMode::CASCADE
            ));

            return new ToOneRelation(
                $idString,
                $this->loadIds
                    ? new ToOneRelationIdentityReference($mapper, $this->bidirectionalRelationProperty)
                    : new ToOneRelationObjectReference($mapper, $this->bidirectionalRelationProperty),
                $columnName,
                $this->identifying
                    ? new IdentifyingRelationMode()
                    : new NonIdentifyingRelationMode()
            );
        });
    }
262369
protected function initSpec($methodName, array $with)
    {
        return new StaticSpec($this->testCase, $this->className, $methodName, $with, Shmock::$policies);
    }
829526
public function addJoinColumn($columnName, $referencedColumnName, $nullable = true, $unique = false, $onDelete = null, $columnDef = null)
    {
        $this->joinColumns[] = array(
            'name' => $columnName,
            'referencedColumnName' => $referencedColumnName,
            'nullable' => $nullable,
            'unique' => $unique,
            'onDelete' => $onDelete,
            'columnDefinition' => $columnDef,
        );
        return $this;
    }
538884
public function columns($columns)
	{
		if (is_null($this->columns))
		{
			$this->columns = new Query\QueryElement('()', $columns);
		}
		else
		{
			$this->columns->append($columns);
		}

		return $this;
	}
21636
public static function build(Table $table, $columnName, $type = null, $options = [])
    {
        $column = new Column();
        $column->setName($columnName);
        $column->setType($type);
        $column->setOptions($options); // map options to column methods

        return new static($table, $column);
    }
604312
public function load($fileName, $withHeader = true)
    {
        if ($this->files->exists($fileName) != true) {
            error('File %s not found', $fileName);
        }

        $this->fileName = $fileName;
        $this->cols = [];
        $this->items = [];

        // Carregar arquivo
        $hnd = fopen($this->fileName, 'r');
        while ($data = fgetcsv($hnd, $this->maxLength, $this->delimiter)) {
            // Primeira linha
            if ((count($this->items) == 0) && (count($this->cols) == 0)) {
                $this->cols = ($withHeader ? $data : array_keys($data));
                if ($withHeader != true) {
                    $this->items[] = $this->make_row($data);
                }
            } else { // Demais linhas
                $this->items[] = $this->make_row($data);
            }
        }
        fclose($hnd);
    }
1149290
public function createColumns(array $columns, $tagName = 'td')
    {
        foreach ($columns as $column) {
            if ($column instanceof Column) {
                $column->tagName = $tagName;
                $this->childNodes->push($column);
            } else {
                $columnElement = $this->createColumn($tagName);
                if ($column instanceof Element) {
                    $columnElement->entity->setEntityName($column->entity->getEntityName());
                    $columnElement->childNodes->push($column);
                } else {
                    $columnElement->entity->setEntityName('col-' . $column);
                    $columnElement->textContent->push($column);
                }
            }
        }

        return $this;
    }
105126
public function dropColumn($columnName) {
        $this->dropColumns[] = $columnName;
        if (array_key_exists($columnName, $this->references)) {
            $this->dropReference($columnName);
        }
        return $this;
    }
1248511
public function columns($columns)
    {
        if (is_null($this->columns)) {
            $this->columns = $this->element('()', $columns);
        } else {
            $this->columns->append($columns);
        }

        return $this;
    }
192678
public function getIdColumnName(bool $withTableName = false): string
    {
        return ($withTableName) ? $this->addTableName($this->idColumnName) : $this->idColumnName;
    }
1288688
public function changeColumn($columnName, $newColumnType, $options = [])
    {
        // create a column object if one wasn't supplied
        if (!$newColumnType instanceof Column) {
            $newColumn = new Column();
            $newColumn->setType($newColumnType);
            $newColumn->setOptions($options);
        } else {
            $newColumn = $newColumnType;
        }

        // if the name was omitted use the existing column name
        if (null === $newColumn->getName() || strlen($newColumn->getName()) === 0) {
            $newColumn->setName($columnName);
        }

        $this->getAdapter()->changeColumn($this->getName(), $columnName, $newColumn);

        return $this;
    }
830181
public function findWhereBetween($attribute, $values, $columns = ['*'], $with = [])
    {
        $values   = $this->castRequest($values);
        $cacheKey = $this->generateKey([$attribute, $values, $columns, $with]);

        return $this->cacheResults(get_called_class(), __FUNCTION__, $cacheKey, function () use ($attribute, $values, $columns, $with) {
            return $this->model->with($with)
                ->whereBetween($attribute, $values)
                ->get($columns);
        });
    }
375009
protected function joinClosureBy($column, $withSelf = false)
    {
        $primary = $this->getQualifiedKeyName();
        $closure = $this->closure->getTable();
        $ancestor = $this->closure->getQualifiedAncestorColumn();
        $descendant = $this->closure->getQualifiedDescendantColumn();

        switch ($column) {
            case 'ancestor':
                $query = $this->join($closure, $ancestor, '=', $primary)
                    ->where($descendant, '=', $this->getKey());
                break;

            case 'descendant':
                $query = $this->join($closure, $descendant, '=', $primary)
                    ->where($ancestor, '=', $this->getKey());
                break;
        }

        $depthOperator = ($withSelf === true ? '>=' : '>');

        $query->where($this->closure->getQualifiedDepthColumn(), $depthOperator, 0);

        return $query;
    }
1181392
public static function tableColumn(Table $table, string $columnName) : ColumnExpr
    {
        if (!$table->hasColumn($columnName)) {
            throw InvalidArgumentException::format(
                'Invalid table column name for table \'%s\': expecting one of (%s), \'%s\' given',
                $table->getName(), Debug::formatValues($table->getColumnNames()), $columnName
            );
        }

        return new ColumnExpr($table->getName(), $table->findColumn($columnName));
    }
614603
public function findOrFail($id, $columns = ['*'], $with = [])
    {
        $cacheKey = $this->generateKey([$id, $columns, $with]);

        return $this->cacheResults(get_called_class(), __FUNCTION__, $cacheKey, function () use ($id, $columns, $with) {
            return $this->model->with($with)
                ->findOrFail($id, $columns);
        });
    }