\Cake\Database\SchemaCollection

Represents a database schema collection

Used to access information about the tables, and other data in a database.

Summary

Methods
Properties
Constants
__construct()
listTables()
describe()
No public properties found
No constants found
_reflect()
$_connection
$_dialect
N/A
No private methods found
No private properties found
N/A

Properties

Methods

__construct()

__construct(\Cake\Database\Connection  $connection) 

Constructor.

Parameters

\Cake\Database\Connection $connection

The connection instance.

listTables()

listTables() : array

Get the list of tables available in the current connection.

Returns

array —

The list of tables in the connected database/schema.

describe()

describe(string  $name, array  $options = array()) : \Cake\Database\Schema\TableSchema

Get the column metadata for a table.

Caching will be applied if cacheMetadata key is present in the Connection configuration options. Defaults to _cakemodel when true.

Options

  • forceRefresh - Set to true to force rebuilding the cached metadata. Defaults to false.

Parameters

string $name

The name of the table to describe.

array $options

The options to use, see above.

Throws

\Cake\Database\Exception

when table cannot be described.

Returns

\Cake\Database\Schema\TableSchema

Object with column metadata.

_reflect()

_reflect(string  $stage, string  $name, array  $config, \Cake\Database\Schema\TableSchema  $schema) : void

Helper method for running each step of the reflection process.

Parameters

string $stage

The stage name.

string $name

The table name.

array $config

The config data.

\Cake\Database\Schema\TableSchema $schema

The table instance

Throws

\Cake\Database\Exception

on query failure.