Class Schema
Representation of a database table schema.
-
ICanBoogie\ActiveRecord\Schema
implements
ArrayAccess,
IteratorAggregate
uses
ICanBoogie\Accessor\AccessorTrait (not available)
Methods summary
protected
get_primary( void )
: array|string|null
Returns the primary key of the schema.
Returns the primary key of the schema.
Returns
array|string|null
A multi-dimensional primary key is returned as an array.
protected
get_indexes( void )
: array
Returns the indexes of the schema.
Returns the indexes of the schema.
Returns
array
protected
get_unique_indexes( void )
: array
Returns unique indexes.
Returns
array
public
__construct( array $options
)
public
offsetExists( string $column_id
)
: boolean
Checks if a column exists.
Checks if a column exists.
Parameters
$column_id
- Column identifier.
Returns
boolean
Implementation of
ArrayAccess::offsetExists()
public
offsetGet( string $column_id
)
: ICanBoogie\ActiveRecord\SchemaColumn
Returns a column.
Parameters
Returns
Throws
ICanBoogie\OffsetNotDefined
if the column is not defined.
Implementation of
ArrayAccess::offsetGet()
public
offsetSet( string $column_id
, string|array|ICanBoogie\ActiveRecord\SchemaColumn
$column_options
)
Adds a column to the schema.
Adds a column to the schema.
Parameters
$column_id
$column_options
Implementation of
ArrayAccess::offsetSet()
public
offsetUnset( string $column_id
)
Removes a column from the schema.
Removes a column from the schema.
Parameters
Implementation of
ArrayAccess::offsetUnset()
public
getIterator( void )
: ArrayIterator
Returns columns iterator.
Returns columns iterator.
Returns
ArrayIterator
Implementation of
IteratorAggregate::getIterator()
public
filter( array $values
)
: array
Filters values according to the schema columns.
Filters values according to the schema columns.
Parameters
Returns
array
Properties summary
Magic properties
public read-only
$indexes
: array
The indexes of the schema.
public read-only
$unique_indexes
: array
The unique indexes of the schema.
public read-only
$primary
: array|string
The primary key of the schema. The primary key is an array if it uses multiple columns.