On this page
Class Collection
Represents a database schema collection
Used to access information about the tables, and other data in a database.
Direct Subclasses
Properties summary
-
Connection object
$_connectionprotected -
Schema dialect instance.
$_dialectprotected
Method Summary
-
__construct() publicConstructor.
-
_reflect() protectedHelper method for running each step of the reflection process.
-
describe() publicGet the column metadata for a table.
-
listTables() publicGet the list of tables available in the current connection.
Method Detail
__construct()source public
__construct( Cake\Database\Connection $connection )
Constructor.
Parameters
Cake\Database\Connection$connection- The connection instance.
_reflect()source protected
_reflect( string $stage , string $name , array $config , Cake\Database\Schema\TableSchema $schema )
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\Exceptionon query failure.
describe()source public
describe( string $name , array $options = [] )
Get the column metadata for a table.
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
-
string
$name - The name of the table to describe.
-
array
$optionsoptional [] - The options to use, see above.
Returns
Cake\Database\Schema\TableSchemaObject with column metadata.
Throws
Cake\Database\Exceptionwhen table cannot be described.
listTables()source public
listTables( )
Get the list of tables available in the current connection.
Returns
arrayThe list of tables in the connected database/schema.
Properties detail
© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/3.7/class-Cake.Database.Schema.Collection.html