DuplicateEntryException
class DuplicateEntryException extends DatabaseException (View source)
Exception for errors related to duplicate entries (e.g. violating a unique index)
Properties
protected | string | $sql | The SQL that generated this error |
from DatabaseException |
protected | array | $parameters | The parameters given for this query, if any |
from DatabaseException |
Methods
public
__construct(string $message = '', string|null $keyName = null, string|null $duplicatedValue = null, string $sql = null, array $parameters = [])
Constructs the database exception
public
string|null
getDuplicatedValue()
Get the value which was duplicated (e.g. combined value of multiple columns in index)
Details
string
getSQL()
Returns the SQL that generated this error
array
getParameters()
The parameters given for this query, if any
__construct(string $message = '', string|null $keyName = null, string|null $duplicatedValue = null, string $sql = null, array $parameters = [])
Constructs the database exception
string|null
getKeyName()
Get the name of the key which the error is for (e.g. index name)
string|null
getDuplicatedValue()
Get the value which was duplicated (e.g. combined value of multiple columns in index)