CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (Github)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 5.3 Chiffon API

  • Project:
    • CakePHP
      • CakePHP
      • Authentication
      • Authorization
      • Chronos
      • Elastic Search
      • Queue
  • Version:
    • 5.3
      • 5.3
      • 5.2
      • 5.1
      • 5.0
      • 4.6
      • 4.5
      • 4.4
      • 4.3
      • 4.2
      • 4.1
      • 4.0
      • 3.10
      • 3.9
      • 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

  • Global
  • Cake
    • Cache
    • Collection
    • Command
    • Console
    • Controller
    • Core
    • Database
      • Driver
      • Exception
      • Expression
      • Log
      • Query
      • Retry
      • Schema
      • Statement
      • Type
    • Datasource
    • Error
    • Event
    • Form
    • Http
    • I18n
    • Log
    • Mailer
    • Network
    • ORM
    • Routing
    • TestSuite
    • Utility
    • Validation
    • View

Class CheckConstraint

Check constraint value object

Models a check constraint.

Namespace: Cake\Database\Schema

Constants

  • string
    CHECK ¶
    TableSchema::CONSTRAINT_CHECK
  • string
    FOREIGN ¶
    TableSchema::CONSTRAINT_FOREIGN
  • string
    PRIMARY ¶
    TableSchema::CONSTRAINT_PRIMARY
  • string
    UNIQUE ¶
    TableSchema::CONSTRAINT_UNIQUE

Property Summary

  • $type protected
    string

Method Summary

  • __construct() public

    Constructor

  • getColumns() public

    Gets the constraint columns.

  • getExpression() public

    Get the check constraint expression.

  • getName() public

    Gets the constraint name.

  • getType() public

    Gets the constraint type.

  • setColumns() public

    Sets the constraint columns.

  • setExpression() public

    Set the check constraint expression.

  • setName() public

    Sets the constraint name.

  • setType() public

    Sets the constraint type.

  • toArray() public

    Converts a constraint to an array that is compatible with the constructor.

Method Detail

__construct() ¶ public

__construct(string $name, string $expression)

Constructor

Parameters
string $name

Constraint name.

string $expression

The check constraint expression (e.g., "age >= 18")

getColumns() ¶ public

getColumns(): ?array<string>

Gets the constraint columns.

Returns
?array<string>

getExpression() ¶ public

getExpression(): string

Get the check constraint expression.

Returns
string

getName() ¶ public

getName(): ?string

Gets the constraint name.

Returns
?string

getType() ¶ public

getType(): string

Gets the constraint type.

Returns
string

setColumns() ¶ public

setColumns(array<string>|string $columns): $this

Sets the constraint columns.

Parameters
array<string>|string $columns

Columns

Returns
$this

setExpression() ¶ public

setExpression(string $expression): $this

Set the check constraint expression.

Parameters
string $expression

The SQL expression for the check constraint

Returns
$this
Throws
InvalidArgumentException

setName() ¶ public

setName(string $name): $this

Sets the constraint name.

Parameters
string $name

Name

Returns
$this

setType() ¶ public

setType(string $type): $this

Sets the constraint type.

Parameters
string $type

Type

Returns
$this

toArray() ¶ public

toArray(): array<string, mixed>

Converts a constraint to an array that is compatible with the constructor.

Returns
array<string, mixed>

Property Detail

$type ¶ protected

Type
string
OpenHub
Pingping
Linode
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (Github)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs