Method that retrieves and returns Table's belongs to fields.

These are fields that dictate assigment, usually foreign key
associated with Groups tables. (example: belongs_to)

@param  \Cake\ORM\Table $table Table instance
@return mixed[]
486595
public static function getTableBelongsToFields(Table $table): array
    {
        $fields = [];
        $belongsToModels = Configure::read('RolesCapabilities.accessCheck.belongsToModels');

        foreach ($table->associations() as $association) {
            // skip non-assignation models
            if (!in_array($association->className(), $belongsToModels)) {
                continue;
            }

            $fields[] = $association->foreignKey();
        }

        return $fields;
    }
376876
protected function parseSchemaAndTable($table)
    {
        $table = explode('.', $table);

        if (is_array($schema = $this->connection->getConfig('schema'))) {
            if (in_array($table[0], $schema)) {
                return [array_shift($table), implode('.', $table)];
            }

            $schema = head($schema);
        }

        return [$schema ?: 'public', implode('.', $table)];
    }
252197
public function getTable($table)
    {
        return array_merge(
            $this->cache['tables'][$table],
            [
                'fields'      => $this->cache['fields'][$table] ?? [],
                'constraints' => $this->cache['constraints'][$table] ?? [],
            ]
        );
    }
845299
protected function getTable($table = '')
    {
        if (empty($table))
        {
            switch (config('auth.driver'))
            {
                case 'eloquent':
                    $table = $this->getTableByModelClass(config('auth.model'));
                    break;
                case 'database':
                default:
                    $table = config('auth.table');
                    break;
            }
        }

        return $table;
    }
312167
public function tableDefintion($table)
    {
        $columnStringArray = [];
        $columns = $this->getTableColumns($table, true);

        foreach ($columns as $key => $column) {
            if ($key === 'id') {
                $column['type'] = 'increments';
            }

            $columnStringArray[] = $key.':'.$this->columnNameCheck($column['type']);
        }

        $columnString = implode(',', $columnStringArray);

        return $columnString;
    }
384743
public function getColumns($table): ?array
	{
		return $this->driverQuery($this->getSql()->columnList($this->prefixTable($table)), FALSE);
	}
389622
public function table(Table\Table $table)
    {
        $data = [];
        foreach($table->getRows() as $row) {

            $line = [];
            foreach($table->getColumns() as $name => $column) {
                $line[] = $column->render((array) $row);
            }

            $data[] = $line;
        }

        return $data;
    }
793726
protected function getTableFields( $_table ) {

        $_sql = "SHOW COLUMNS FROM {$_table}";
        $_ret = $this->execute( $_sql );
        $_fields = array();
        if ( $_ret != false ) {
            while ( ($_rows = $_ret->fetch()) != false ) {
                $_fields[] = $_rows[0];
            }
        }
        return $_fields;
    }
1211436
function GetFields($table)
    {
        $fields = array();
        $sql = new Sql\Builder($this);
        $tbl = $sql->Table('information_schema.columns', array('TABLE_SCHEMA', 'TABLE_NAME', 'COLUMN_NAME'));
        $cond = $sql->Equals($tbl->Field('TABLE_SCHEMA'), $sql->Value($this->dbName))
                ->And_($sql->Equals($tbl->Field('TABLE_NAME'), $sql->Value($table)));
        $what = $sql->SelectList($tbl->Field('COLUMN_NAME'));
        $select = $sql->Select(true, $what, $tbl, $cond);
        $reader = $this->ExecuteQuery((string) $select);
        while ($reader->Read())
        {
            $fields[] = $reader->ByIndex(0);
        }
        return $fields;
    }
383329
public function getFields($table)
	{
		if (isset($this->tables[$table])) {
			return new Collection($this->tables[$table]);
		}
	}
499095
private function getFields($table)
    {
        $fields = $this->entity->getFieldNames();
        if (empty($this->with) && $this->alias === null) {
            return $fields;
        }

        $table = $this->getTableAlias($table);

        $prefixIfMissing = function ($field) use ($table) {
            if (strpos($field, '.') !== false) {
                return $field;
            }

            return $table . '.' . $field;
        };

        return array_map($prefixIfMissing, $fields);
    }
730606
private function get_columns( $table ) {
		global $wpdb;

		$table_sql    = $this->esc_sql_ident( $table );
		$primary_keys = $text_columns = $all_columns = array();

		foreach ( $wpdb->get_results( "DESCRIBE $table_sql" ) as $col ) {
			if ( 'PRI' === $col->Key ) {
				$primary_keys[] = $col->Field;
			}

			if ( $this->is_text_col( $col->Type ) ) {
				$text_columns[] = $col->Field;
			}

			$all_columns[] = $col->Field;
		}

		return array( $primary_keys, $text_columns, $all_columns );
	}
1103705
public static function getTableAssignationFields(Table $table): array
    {
        $fields = [];
        $assignationModels = Configure::read('RolesCapabilities.accessCheck.assignationModels');

        foreach ($table->associations() as $association) {
            // skip non-assignation models
            if (!in_array($association->className(), $assignationModels)) {
                continue;
            }

            $fields[] = $association->getForeignKey();
        }

        return $fields;
    }
609559
public function MetaColumns($table)
    {
        $sm = $this->getSchemaManager();
        $schemaColumns = $sm->listTableColumns($table);

        return $schemaColumns;
    }
1265773
public function getPrimaryKeys($table)
    {
        $pk = [];
        $cols = $this->getColumns($table);
        if ($cols) {
            foreach ($cols as $key => $val){
                if(isset($val['is_primary']) && $val['is_primary']) {
                    $pk[] = $key;
                }
            }
        }
        
        return $pk;
    }
432760
public function getTableIndexes( $table )
    {
        $query = "SELECT * FROM sqlite_master WHERE type='index' AND tbl_name = '$table'";

        $results = $this->query( $query );

        $indexes = [ ];

        foreach ( $results as $result )
        {
            $indexes[ ] = $result[ 'name' ];
        }

        return $indexes;
    }
828285
public static function get_table_columns( $table ) {

		global $wpdb;

		self::query( "SHOW COLUMNS FROM `{$table}` " );

		$table_columns = $wpdb->last_result;

		$table_cols_and_types = array();

		foreach ( $table_columns as $table_col ) {
			// Get only the type, not the attributes.
			if ( false === strpos( $table_col->Type, '(' ) ) {
				$modified_type = $table_col->Type;
			} else {
				$modified_type = substr( $table_col->Type, 0, ( strpos( $table_col->Type, '(' ) ) );
			}

			$table_cols_and_types[ $table_col->Field ] = $modified_type;
		}

		return $table_cols_and_types;
	}