Generates key index defaultColumns in models
@return array
193647
public static function getActiveDefaultColumns($columns)
	{
		$column = array();

		foreach($columns as $val) {
			$keyIndex = self::getKeyIndex($val);
			if($keyIndex)
				$column[] = $keyIndex;
		}

		return $column;
	}
60381
public function getIndexes()
    {
        $query = $this->db->getQuery(true);
        $table = $this->db->replacePrefix($this->name);

        $query->select([
            'tbl.name AS table_name',
            'col.name AS column_name',
            'idx.name AS index_name',
            'col.*',
            'idx.*'
        ])
            ->from('sys.columns AS col')
            ->leftJoin(
                'sys.tables AS tbl',
                'col.object_id = tbl.object_id'
            )
            ->leftJoin(
                'sys.index_columns AS ic',
                'col.column_id = ic.column_id AND ic.object_id = tbl.object_id'
            )
            ->leftJoin(
                'sys.indexes AS idx',
                'idx.object_id = tbl.object_id AND idx.index_id = ic.index_id'
            )
            ->where('tbl.name = %q', $table)

            ->where('(idx.name IS NOT NULL OR col.is_identity = 1 OR idx.is_primary_key = 1)');

        $indexes = $this->db->prepare($query)->loadAll();

        $keys = [];

        foreach ($indexes as $index) {
            $key = new \stdClass();

            $key->Table = $table;
            $key->Is_primary = $index->is_primary_key ?: $index->is_identity;
            $key->Non_unique = !$index->is_unique;
            $key->Key_name = $key->Is_primary ? 'PRIMARY' : $index->index_name;
            $key->Column_name = $index->column_name;
            $key->Collation = 'A';
            $key->Cardinality = 0;
            $key->Sub_part = null;
            $key->Packed = null;
            $key->Null = null;
            $key->Index_type = 'BTREE';
            // TODO: Finish comments query
            $key->Comment = null;
            $key->Index_comment = null;
            $key->is_identity = $index->is_identity ? 'auto_increment' : '';

            $keys[] = $key;
        }

        return $keys;
    }
1061337
public function getColumnArray() {
        $fields = array('name','type','passThrough','default','nullable',
                        'index','unique','after','pkey');
        $fields = array_flip($fields);
        foreach($fields as $key => &$val)
            $val = $this->{$key};
        unset($val);
        return $fields;
    }
767597
public function getWeightColumns() {
        $out = array();
        foreach ($this->_relationConfig as $i => $conf) {
            $out[] = $conf[self::WEIGHT_COLUMN_KEY];
        }
        return $out;
    }
194218
public function generateAddedFields()
    {
        foreach ($this->keptModelKeys as $modelName) {
            $oldFieldKeys = $this->oldFieldKeys[$modelName];
            $newFieldKeys = $this->newFieldKeys[$modelName];

            $addedFields = array_diff($newFieldKeys, $oldFieldKeys);

            foreach ($addedFields as $addedField) {
                $this->findAddedFields($modelName, $addedField);
            }
        }
    }
633676
protected function getTableColumns()
    {
        if (0 === count(self::$tableColumns)) {
            $table = $this->getTable();
            $connect = $this->getConnection();
            $builder = $connect->getSchemaBuilder();
            $columns = $builder->getColumnListing($table);

            self::$tableColumns = (array)$columns;
        }
        return self::$tableColumns;
    }
903733
private function getDatatableColumns(): array
    {
        $result = $this->getDisplayColumns();

        if (!$this->getGroupByField()) {
            $result[] = Utility::MENU_PROPERTY_NAME;
        }

        if (!$this->getGroupByField() && $this->batch) {
            $table = TableRegistry::get($this->entity->get('model'));
            // add primary key in FIRST position
            foreach ((array)$table->getPrimaryKey() as $primaryKey) {
                array_unshift($result, $table->aliasField($primaryKey));
            }
        }

        return $result;
    }
889790
public function getPrimaryKeyIndex()
    {
        $database = DatabaseLayer::getInstance();

        $columns = array();

        if ($this instanceof VersionedActiveRecord) {
            $schema = $this->getClassSchema();
            $firstColumn = reset($schema)['name'];
            $columns = [$firstColumn => $firstColumn, "sequence" => "sequence"];
        } else {
            foreach ($database->getTableIndexes($this->_table) as $key) {
                $columns[$key->Column_name] = $key->Column_name;
            }
        }

        return array_values($columns);
    }
782641
public function columnKeys()
    {
        $columnKeys = [];

        foreach ($this->columns() as $key => $column) {
            if (is_string($key)) {
                $columnKeys[] = $key;
            } elseif (str_contains($column, '.')) {
                list($table, $columnKey) = explode('.', $column);
                $columnKeys[]            = $columnKey;
            } else {
                $columnKeys[] = $column;
            }
        }

        return $columnKeys;
    }
828413
protected function getInsertColumnList()
    {
        $columns             = [];
        $versionPropertyName = $this->class->isVersioned()
            ? $this->class->versionProperty->getName()
            : null;

        foreach ($this->class->getDeclaredPropertiesIterator() as $name => $property) {
            /*if (isset($this->class->embeddedClasses[$name])) {
                continue;
            }*/

            switch (true) {
                case $property instanceof VersionFieldMetadata:
                    // Do nothing
                    break;

                case $property instanceof LocalColumnMetadata:
                    if (($property instanceof FieldMetadata
                            && (
                                ! $property->hasValueGenerator()
                                || $property->getValueGenerator()->getType() !== GeneratorType::IDENTITY
                            )
                        )
                        || $this->class->identifier[0] !== $name
                    ) {
                        $columnName = $property->getColumnName();

                        $columns[] = $columnName;

                        $this->columns[$columnName] = $property;
                    }

                    break;

                case $property instanceof AssociationMetadata:
                    if ($property->isOwningSide() && $property instanceof ToOneAssociationMetadata) {
                        $targetClass = $this->em->getClassMetadata($property->getTargetEntity());

                        foreach ($property->getJoinColumns() as $joinColumn) {
                            /** @var JoinColumnMetadata $joinColumn */
                            $columnName           = $joinColumn->getColumnName();
                            $referencedColumnName = $joinColumn->getReferencedColumnName();

                            if (! $joinColumn->getType()) {
                                $joinColumn->setType(PersisterHelper::getTypeOfColumn($referencedColumnName, $targetClass, $this->em));
                            }

                            $columns[] = $columnName;

                            $this->columns[$columnName] = $joinColumn;
                        }
                    }

                    break;
            }
        }

        return $columns;
    }
1034232
public function getLocalPrimaryKeys()
    {
        $cols = [];
        $localCols = $this->getLocalColumnObjects();

        foreach ($localCols as $localCol) {
            if ($localCol->isPrimaryKey()) {
                $cols[] = $localCol;
            }
        }

        return $cols;
    }
1129843
public function getColumns()
    {
        $primaryKey        = $this->getPrimaryKey();
        $primaryKeyColumns = [];

        if ($primaryKey !== null) {
            $primaryKeyColumns = $this->filterColumns($primaryKey->getColumns());
        }

        return array_merge($primaryKeyColumns, $this->getForeignKeyColumns(), $this->_columns);
    }
116124
public function getColumns()
    {
        $session = request()->session();
        $key     = $this->key();
        if (!$session->has($key)) {
            return $this->columns;
        }
        $config = $session->get($key);
        foreach ($this->columns as $index => $column) {
            if (!isset($config[$index])) {
                continue;
            }
            $column->visible = $config[$index];
        }

        return $this->columns;
    }
216754
protected function buildMapperPrimaryKeys()
    {

        $fields = array();

        foreach ($this->columns as $column) {
            if ($column->isPrimaryKey()) {
                $fields[] = "        '" . $column->getName() . "'";
            }
        }

        $this->vars['db_primary_keys'] = implode(",\n", $fields);
    }
744318
public function getColumns()
    {
        $translationManager = $this->framework->getInstance('\\Zepi\\Core\\Language\\Manager\\TranslationManager');
        
        return array(
            new Column('name', $translationManager->translate('Username', '\\Zepi\\Web\\AccessControl'), 50, true, true, Column::DATA_TYPE_HTML, 'icon-column'),
            new Column('uuid', $translationManager->translate('UUID', '\\Zepi\\Web\\AccessControl'), 50, true, true, Column::DATA_TYPE_STRING),
            new Column('actions', '', Column::WIDTH_AUTO, false, false, Column::DATA_TYPE_HTML, 'auto-width button-column')
        );
    }
441600
private function getAdditionalColumns()
    {
        $columns = ['facet_display_mode' => 'fal.facet_display_mode'];

        foreach ($this->overridenColumns as $column) {
            $columns[$column] = new \Zend_Db_Expr("COALESCE(fal.$column, additional_table.$column)");
            $columns['use_default_' . $column] = new \Zend_Db_Expr("IF(fal.$column IS NULL, 1, 0)");
            $columns['default_' . $column] = "additional_table.$column";
        }

        $maxPosition = $this->getMaxPosition() + 1;
        $columns['position'] = new \Zend_Db_Expr("IF(fal.position IS NULL, {$maxPosition} + additional_table.position, fal.position)");

        return $columns;
    }
1000266
protected function getColumns(): array
    {
        $link = config('cortex.foundation.route.locale_prefix')
            ? '"<a href=\""+routes.route(\'managerarea.roles.edit\', {role: full.id, locale: \''.$this->request->segment(1).'\'})+"\">"+data+"</a>"'
            : '"<a href=\""+routes.route(\'managerarea.roles.edit\', {role: full.id})+"\">"+data+"</a>"';

        return [
            'title' => ['title' => trans('cortex/auth::common.title'), 'render' => $link, 'responsivePriority' => 0],
            'name' => ['title' => trans('cortex/auth::common.name')],
            'created_at' => ['title' => trans('cortex/auth::common.created_at'), 'render' => "moment(data).format('YYYY-MM-DD, hh:mm:ss A')"],
            'updated_at' => ['title' => trans('cortex/auth::common.updated_at'), 'render' => "moment(data).format('YYYY-MM-DD, hh:mm:ss A')"],
        ];
    }