Fr3nch13/CakePHP Utilities

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

Methods

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
throws
DatabaseException

when table cannot be described.

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.

Tags
throws
DatabaseException

on query failure.

uses
SchemaDialect::describeColumnSql
uses
SchemaDialect::describeIndexSql
uses
SchemaDialect::describeForeignKeySql
uses
SchemaDialect::describeOptionsSql
uses
SchemaDialect::convertColumnDescription
uses
SchemaDialect::convertIndexDescription
uses
SchemaDialect::convertForeignKeyDescription
uses
SchemaDialect::convertOptionsDescription

        
On this page

Search results