Collection
in package
implements
CollectionInterface
Represents a database schema collection
Used to access information about the tables, and other data in a database.
Table of Contents
Interfaces
- CollectionInterface
- Represents a database schema collection
Properties
- $_connection : Connection
- Connection object
- $_dialect : SchemaDialect
- Schema dialect instance.
Methods
- __construct() : mixed
- Constructor.
- describe() : TableSchema
- Get the column metadata for a table.
- listTables() : array<string|int, string>
- Get the list of tables and views available in the current connection.
- listTablesWithoutViews() : array<string|int, string>
- Get the list of tables, excluding any views, available in the current connection.
- _reflect() : void
- Helper method for running each step of the reflection process.
Properties
$_connection
Connection object
protected
Connection
$_connection
$_dialect
Schema dialect instance.
protected
SchemaDialect
$_dialect
Methods
__construct()
Constructor.
public
__construct(Connection $connection) : mixed
Parameters
- $connection : Connection
-
The connection instance.
describe()
Get the column metadata for a table.
public
describe(string $name[, array<string, mixed> $options = [] ]) : TableSchema
The name can include a database schema name in the form 'schema.table'.
Caching will be applied if cacheMetadata
key is present in the Connection
configuration options. Defaults to cake_model when true.
Options
-
forceRefresh
- Set to true to force rebuilding the cached metadata. Defaults to false.
Parameters
- $name : string
-
The name of the table to describe.
- $options : array<string, mixed> = []
-
The options to use, see above.
Tags
Return values
TableSchema —Object with column metadata.
listTables()
Get the list of tables and views available in the current connection.
public
listTables() : array<string|int, string>
Return values
array<string|int, string> —The list of tables and views in the connected database/schema.
listTablesWithoutViews()
Get the list of tables, excluding any views, available in the current connection.
public
listTablesWithoutViews() : array<string|int, string>
Return values
array<string|int, string> —The list of tables in the connected database/schema.
_reflect()
Helper method for running each step of the reflection process.
protected
_reflect(string $stage, string $name, array<string, mixed> $config, TableSchema $schema) : void
Parameters
- $stage : string
-
The stage name.
- $name : string
-
The table name.
- $config : array<string, mixed>
-
The config data.
- $schema : TableSchema
-
The table schema instance.