interface DBIndexable (View source)

Classes that implement the DBIndexable interface will provide options to set various index types and index contents, which will be processed by \SilverStripe\ORM\DataObjectSchema

Constants

TYPE_INDEX

Index types that can be used. Please check your database driver to ensure choices are supported.

TYPE_UNIQUE

TYPE_FULLTEXT

TYPE_DEFAULT

If "true" is provided to setIndexType, this default index type will be returned

Methods

public
$this
setIndexType(string|bool $type)

Set the desired index type to use

public
string|bool
getIndexType()

Return the desired index type to use. Will return false if the field instance should not be indexed.

public
array
getIndexSpecs()

Returns the index specifications for the field instance, for example:

Details

$this setIndexType(string|bool $type)

Set the desired index type to use

Parameters

string|bool $type

Either of the types listed in SilverStripe\ORM\FieldType\DBIndexable, or boolean true to indicate that the default index type should be used.

Return Value

$this

Exceptions

InvalidArgumentException

string|bool getIndexType()

Return the desired index type to use. Will return false if the field instance should not be indexed.

Return Value

string|bool

array getIndexSpecs()

Returns the index specifications for the field instance, for example:

[
    'type' => 'unique',
    'columns' => ['FieldName']
]

Return Value

array