Skip to content
PHP Ecosystem
Explore

ConstraintFinderInterface

API reference › yii › db › ConstraintFinderInterface

interfaceyii\db\ConstraintFinderInterface
Since2.0.14
Sourceframework/db/ConstraintFinderInterface.php
Implemented by 5 types

ConstraintFinderInterface defines methods for getting a table constraint information.

MethodDescriptionDefined by
getSchemaChecks() abstractReturns check constraints for all tables in the database.ConstraintFinderInterface
getSchemaDefaultValues() abstractReturns default value constraints for all tables in the database.ConstraintFinderInterface
getSchemaForeignKeys() abstractReturns foreign keys for all tables in the database.ConstraintFinderInterface
getSchemaIndexes() abstractReturns indexes for all tables in the database.ConstraintFinderInterface
getSchemaPrimaryKeys() abstractReturns primary keys for all tables in the database.ConstraintFinderInterface
getSchemaUniques() abstractReturns unique constraints for all tables in the database.ConstraintFinderInterface
getTableChecks() abstractObtains the check constraints information for the named table.ConstraintFinderInterface
getTableDefaultValues() abstractObtains the default value constraints information for the named table.ConstraintFinderInterface
getTableForeignKeys() abstractObtains the foreign keys information for the named table.ConstraintFinderInterface
getTableIndexes() abstractObtains the indexes information for the named table.ConstraintFinderInterface
getTablePrimaryKey() abstractObtains the primary key for the named table.ConstraintFinderInterface
getTableUniques() abstractObtains the unique constraints information for the named table.ConstraintFinderInterface
abstract public function getSchemaChecks(string $schema = '', bool $refresh = false): yii\db\CheckConstraint[][]

Returns check constraints for all tables in the database.

Parameters

ParameterTypeDescription
$schemastringThe schema of the tables. Defaults to empty string, meaning the current or default schema name.
$refreshboolWhether to fetch the latest available table schemas. If this is false, cached data may be returned if available.

Returns

CheckConstraint[][]: Check constraints for all tables in the database. Each array element is an array of CheckConstraint or its child classes.

abstract public function getSchemaDefaultValues(string $schema = '', bool $refresh = false): yii\db\DefaultValueConstraint[]

Returns default value constraints for all tables in the database.

Parameters

ParameterTypeDescription
$schemastringThe schema of the tables. Defaults to empty string, meaning the current or default schema name.
$refreshboolWhether to fetch the latest available table schemas. If this is false, cached data may be returned if available.

Returns

DefaultValueConstraint[]: Default value constraints for all tables in the database. Each array element is an array of DefaultValueConstraint or its child classes.

abstract public function getSchemaForeignKeys(string $schema = '', bool $refresh = false): yii\db\ForeignKeyConstraint[][]

Returns foreign keys for all tables in the database.

Parameters

ParameterTypeDescription
$schemastringThe schema of the tables. Defaults to empty string, meaning the current or default schema name.
$refreshboolWhether to fetch the latest available table schemas. If this is false, cached data may be returned if available.

Returns

ForeignKeyConstraint[][]: Foreign keys for all tables in the database. Each array element is an array of ForeignKeyConstraint or its child classes.

abstract public function getSchemaIndexes(string $schema = '', bool $refresh = false): yii\db\IndexConstraint[][]

Returns indexes for all tables in the database.

Parameters

ParameterTypeDescription
$schemastringThe schema of the tables. Defaults to empty string, meaning the current or default schema name.
$refreshboolWhether to fetch the latest available table schemas. If this is false, cached data may be returned if available.

Returns

IndexConstraint[][]: Indexes for all tables in the database. Each array element is an array of IndexConstraint or its child classes.

abstract public function getSchemaPrimaryKeys(string $schema = '', bool $refresh = false): yii\db\Constraint[]

Returns primary keys for all tables in the database.

Parameters

ParameterTypeDescription
$schemastringThe schema of the tables. Defaults to empty string, meaning the current or default schema name.
$refreshboolWhether to fetch the latest available table schemas. If this is false, cached data may be returned if available.

Returns

Constraint[]: Primary keys for all tables in the database. Each array element is an instance of Constraint or its child class.

abstract public function getSchemaUniques(string $schema = '', bool $refresh = false): yii\db\Constraint[][]

Returns unique constraints for all tables in the database.

Parameters

ParameterTypeDescription
$schemastringThe schema of the tables. Defaults to empty string, meaning the current or default schema name.
$refreshboolWhether to fetch the latest available table schemas. If this is false, cached data may be returned if available.

Returns

Constraint[][]: Unique constraints for all tables in the database. Each array element is an array of Constraint or its child classes.

abstract public function getTableChecks(string $name, bool $refresh = false): yii\db\CheckConstraint[]

Obtains the check constraints information for the named table.

Parameters

ParameterTypeDescription
$namestringTable name. The table name may contain schema name if any. Do not quote the table name.
$refreshboolWhether to reload the information even if it is found in the cache.

Returns

CheckConstraint[]: Table check constraints.

abstract public function getTableDefaultValues(string $name, bool $refresh = false): yii\db\DefaultValueConstraint[]

Obtains the default value constraints information for the named table.

Parameters

ParameterTypeDescription
$namestringTable name. The table name may contain schema name if any. Do not quote the table name.
$refreshboolWhether to reload the information even if it is found in the cache.

Returns

DefaultValueConstraint[]: Table default value constraints.

abstract public function getTableForeignKeys(string $name, bool $refresh = false): yii\db\ForeignKeyConstraint[]

Obtains the foreign keys information for the named table.

Parameters

ParameterTypeDescription
$namestringTable name. The table name may contain schema name if any. Do not quote the table name.
$refreshboolWhether to reload the information even if it is found in the cache.

Returns

ForeignKeyConstraint[]: Table foreign keys.

abstract public function getTableIndexes(string $name, bool $refresh = false): yii\db\IndexConstraint[]

Obtains the indexes information for the named table.

Parameters

ParameterTypeDescription
$namestringTable name. The table name may contain schema name if any. Do not quote the table name.
$refreshboolWhether to reload the information even if it is found in the cache.

Returns

IndexConstraint[]: Table indexes.

abstract public function getTablePrimaryKey(string $name, bool $refresh = false): yii\db\Constraint|null

Obtains the primary key for the named table.

Parameters

ParameterTypeDescription
$namestringTable name. The table name may contain schema name if any. Do not quote the table name.
$refreshboolWhether to reload the information even if it is found in the cache.

Returns

Constraint|null: Table primary key, null if the table has no primary key.

abstract public function getTableUniques(string $name, bool $refresh = false): yii\db\Constraint[]

Obtains the unique constraints information for the named table.

Parameters

ParameterTypeDescription
$namestringTable name. The table name may contain schema name if any. Do not quote the table name.
$refreshboolWhether to reload the information even if it is found in the cache.

Returns

Constraint[]: Table unique constraints.