CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Team
    • Issues (Github)
    • YouTube Channel
    • Get Involved
    • Bakery
    • Featured Resources
    • Newsletter
    • Certification
    • My CakePHP
    • CakeFest
    • Facebook
    • Twitter
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 3.8 Red Velvet API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 3.8
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Namespaces

  • Cake
    • Auth
      • Storage
    • Cache
      • Engine
    • Collection
      • Iterator
    • Command
    • Console
      • Exception
    • Controller
      • Component
      • Exception
    • Core
      • Configure
        • Engine
      • Exception
      • Retry
    • Database
      • Driver
      • Exception
      • Expression
      • Schema
      • Statement
      • Type
    • Datasource
      • Exception
    • Error
      • Middleware
    • Event
      • Decorator
    • Filesystem
    • Form
    • Http
      • Client
        • Adapter
        • Auth
      • Cookie
      • Exception
      • Middleware
      • Session
    • I18n
      • Formatter
      • Middleware
      • Parser
    • Log
      • Engine
    • Mailer
      • Exception
      • Transport
    • Network
      • Exception
    • ORM
      • Association
      • Behavior
        • Translate
      • Exception
      • Locator
      • Rule
    • Routing
      • Exception
      • Filter
      • Middleware
      • Route
    • Shell
      • Helper
      • Task
    • TestSuite
      • Fixture
      • Stub
    • Utility
      • Exception
    • Validation
    • View
      • Exception
      • Form
      • Helper
      • Widget
  • None

Classes

  • BaseSchema
  • CachedCollection
  • Collection
  • MysqlSchema
  • PostgresSchema
  • SqliteSchema
  • SqlserverSchema
  • TableSchema

Interfaces

  • SqlGeneratorInterface
  • TableSchemaAwareInterface
  • TableSchemaInterface

Interface TableSchemaInterface

An interface used by database TableSchema objects.

Cake\Database\Schema\TableSchemaInterface implements Cake\Datasource\SchemaInterface
Direct Implementers
  • Cake\Database\Schema\TableSchema
Namespace: Cake\Database\Schema
Location: Database/Schema/TableSchemaInterface.php

Constants summary

  • string
    TYPE_BIGINTEGER ¶
    'biginteger'
  • string
    TYPE_BINARY ¶
    'binary'
  • string
    TYPE_BINARY_UUID ¶
    'binaryuuid'
  • string
    TYPE_BOOLEAN ¶
    'boolean'
  • string
    TYPE_DATE ¶
    'date'
  • string
    TYPE_DATETIME ¶
    'datetime'
  • string
    TYPE_DECIMAL ¶
    'decimal'
  • string
    TYPE_FLOAT ¶
    'float'
  • string
    TYPE_INTEGER ¶
    'integer'
  • string
    TYPE_JSON ¶
    'json'
  • string
    TYPE_SMALLINTEGER ¶
    'smallinteger'
  • string
    TYPE_STRING ¶
    'string'
  • string
    TYPE_TEXT ¶
    'text'
  • string
    TYPE_TIME ¶
    'time'
  • string
    TYPE_TIMESTAMP ¶
    'timestamp'
  • string
    TYPE_TINYINTEGER ¶
    'tinyinteger'
  • string
    TYPE_UUID ¶
    'uuid'

Method Summary

  • addConstraint() public
    Add a constraint.
  • addIndex() public
    Add an index.
  • constraints() public
    Get the names of all the constraints in the table.
  • dropConstraint() public
    Remove a constraint.
  • getConstraint() public
    Read information about a constraint based on name.
  • getIndex() public
    Read information about an index based on name.
  • hasAutoincrement() public
    Check whether or not a table has an autoIncrement column defined.
  • indexes() public
    Get the names of all the indexes in the table.
  • isTemporary() public
    Gets whether the table is temporary in the database.
  • primaryKey() public
    Get the column(s) used for the primary key.
  • setTemporary() public
    Sets whether the table is temporary in the database.

Method Detail

addConstraint() public ¶

addConstraint( string $name , array $attrs )

Add a constraint.

Used to add constraints to a table. For example primary keys, unique keys and foreign keys.

Attributes

  • type The type of constraint being added.
  • columns The columns in the index.
  • references The table, column a foreign key references.
  • update The behavior on update. Options are 'restrict', 'setNull', 'cascade', 'noAction'.
  • delete The behavior on delete. Options are 'restrict', 'setNull', 'cascade', 'noAction'.

The default for 'update' & 'delete' is 'cascade'.

Parameters
string $name
The name of the constraint.
array $attrs
The attributes for the constraint.
Returns

$this

addIndex() public ¶

addIndex( string $name , array $attrs )

Add an index.

Used to add indexes, and full text indexes in platforms that support them.

Attributes

  • type The type of index being added.
  • columns The columns in the index.
Parameters
string $name
The name of the index.
array $attrs
The attributes for the index.
Returns

$this

constraints() public ¶

constraints( )

Get the names of all the constraints in the table.

Returns
string[]

dropConstraint() public ¶

dropConstraint( string $name )

Remove a constraint.

Parameters
string $name
Name of the constraint to remove
Returns

$this

getConstraint() public ¶

getConstraint( string $name )

Read information about a constraint based on name.

Parameters
string $name
The name of the constraint.
Returns
array|null
Array of constraint data, or null

getIndex() public ¶

getIndex( string $name )

Read information about an index based on name.

Parameters
string $name
The name of the index.
Returns
array|null
Array of index data, or null

hasAutoincrement() public ¶

hasAutoincrement( )

Check whether or not a table has an autoIncrement column defined.

Returns
boolean

indexes() public ¶

indexes( )

Get the names of all the indexes in the table.

Returns
string[]

isTemporary() public ¶

isTemporary( )

Gets whether the table is temporary in the database.

Returns
boolean
The current temporary setting.

primaryKey() public ¶

primaryKey( )

Get the column(s) used for the primary key.

Returns
array

Column name(s) for the primary key. An empty list will be returned when the table has no primary key.


setTemporary() public ¶

setTemporary( boolean $temporary )

Sets whether the table is temporary in the database.

Parameters
boolean $temporary
Whether or not the table is to be temporary.
Returns

$this
Follow @CakePHP
#IRC
OpenHub
Rackspace
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Logos & Trademarks
  • Community
  • Team
  • Issues (Github)
  • YouTube Channel
  • Get Involved
  • Bakery
  • Featured Resources
  • Newsletter
  • Certification
  • My CakePHP
  • CakeFest
  • Facebook
  • Twitter
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs