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

  • ConnectionManager
  • ConnectionRegistry
  • FactoryLocator
  • Paginator
  • QueryCacher
  • ResultSetDecorator
  • RulesChecker

Interfaces

  • ConnectionInterface
  • EntityInterface
  • FixtureInterface
  • InvalidPropertyInterface
  • PaginatorInterface
  • QueryInterface
  • RepositoryInterface
  • ResultSetInterface
  • SchemaInterface
  • TableSchemaInterface

Traits

  • EntityTrait
  • ModelAwareTrait
  • QueryTrait
  • RulesAwareTrait

Interface SchemaInterface

An interface used by TableSchema objects.

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

Method Summary

  • addColumn() public
    Add a column to the table.
  • baseColumnType() public

    Returns the base type name for the provided column. This represent the database type a more complex class is based upon.

  • columns() public
    Get the column names in the table.
  • defaultValues() public
    Get a hash of columns and their default values.
  • getColumn() public
    Get column data in the table.
  • getColumnType() public
    Returns column type or null if a column does not exist.
  • getOptions() public
    Gets the options for a table.
  • hasColumn() public
    Returns true if a column exists in the schema.
  • isNullable() public
    Check whether or not a field is nullable
  • name() public
    Get the name of the table.
  • removeColumn() public
    Remove a column from the table schema.
  • setColumnType() public
    Sets the type of a column.
  • setOptions() public
    Sets the options for a table.
  • typeMap() public

    Returns an array where the keys are the column names in the schema and the values the database type they have.

Method Detail

addColumn() public ¶

addColumn( string $name , array|string $attrs )

Add a column to the table.

Attributes

Columns can have several attributes:

  • type The type of the column. This should be one of CakePHP's abstract types.
  • length The length of the column.
  • precision The number of decimal places to store for float and decimal types.
  • default The default value of the column.
  • null Whether or not the column can hold nulls.
  • fixed Whether or not the column is a fixed length column. This is only present/valid with string columns.
  • unsigned Whether or not the column is an unsigned column. This is only present/valid for integer, decimal, float columns.

In addition to the above keys, the following keys are implemented in some database dialects, but not all:

  • comment The comment for the column.
Parameters
string $name
The name of the column
array|string $attrs
The attributes for the column.
Returns

$this

baseColumnType() public ¶

baseColumnType( string $column )

Returns the base type name for the provided column. This represent the database type a more complex class is based upon.

Parameters
string $column
The column name to get the base type from
Returns
string|null
The base type name

columns() public ¶

columns( )

Get the column names in the table.

Returns
string[]

defaultValues() public ¶

defaultValues( )

Get a hash of columns and their default values.

Returns
array

getColumn() public ¶

getColumn( string $name )

Get column data in the table.

Parameters
string $name
The column name.
Returns
array|null
Column data or null.

getColumnType() public ¶

getColumnType( string $name )

Returns column type or null if a column does not exist.

Parameters
string $name
The column to get the type of.
Returns
string|null

getOptions() public ¶

getOptions( )

Gets the options for a table.

Table options allow you to set platform specific table level options. For example the engine type in MySQL.

Returns
array
An array of options.

hasColumn() public ¶

hasColumn( string $name )

Returns true if a column exists in the schema.

Parameters
string $name
Column name.
Returns
boolean

isNullable() public ¶

isNullable( string $name )

Check whether or not a field is nullable

Missing columns are nullable.

Parameters
string $name
The column to get the type of.
Returns
boolean
Whether or not the field is nullable.

name() public ¶

name( )

Get the name of the table.

Returns
string

removeColumn() public ¶

removeColumn( string $name )

Remove a column from the table schema.

If the column is not defined in the table, no error will be raised.

Parameters
string $name
The name of the column
Returns

$this

setColumnType() public ¶

setColumnType( string $name , string $type )

Sets the type of a column.

Parameters
string $name
The column to set the type of.
string $type
The type to set the column to.
Returns

$this

setOptions() public ¶

setOptions( array $options )

Sets the options for a table.

Table options allow you to set platform specific table level options. For example the engine type in MySQL.

Parameters
array $options
The options to set, or null to read options.
Returns

$this

typeMap() public ¶

typeMap( )

Returns an array where the keys are the column names in the schema and the values the database type they have.

Returns
array
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