class UniqueConstraintViolationException extends QueryException

Properties

string $connectionName

The database connection name.

from  QueryException
protected string $sql

The SQL for the query.

from  QueryException
protected array $bindings

The bindings for the query.

from  QueryException
null|"read"|"write" $readWriteType

The PDO read / write type for the executed query.

from  QueryException
protected array $connectionDetails

The connection details for the query (host, port, database, etc.).

from  QueryException
string|null $index

The unique index which prevented the query.

list<string> $columns

The columns which caused the violation.

Methods

__construct(string $connectionName, string $sql, array $bindings, Throwable $previous, array $connectionDetails = [], string|null $readWriteType = null)

Create a new query exception instance.

string
formatMessage(string $connectionName, string $sql, array $bindings, Throwable $previous)

Format the SQL error message.

string
formatConnectionDetails()

Format the connection details for the error message.

string
getConnectionName()

Get the connection name for the query.

string
getSql()

Get the SQL for the query.

string
getRawSql()

Get the raw SQL representation of the query with embedded bindings.

array
getBindings()

Get the bindings for the query.

array
getConnectionDetails()

Get information about the connection such as host, port, database, etc.

setIndex(string|null $index)

Set the unique index which caused the violation.

setColumns(array $columns)

Set the columns that caused the violation.

Details

in QueryException at line 46
__construct(string $connectionName, string $sql, array $bindings, Throwable $previous, array $connectionDetails = [], string|null $readWriteType = null)

Create a new query exception instance.

Parameters

string $connectionName
string $sql
array $bindings
Throwable $previous
array $connectionDetails
string|null $readWriteType

in QueryException at line 72
protected string formatMessage(string $connectionName, string $sql, array $bindings, Throwable $previous)

Format the SQL error message.

Parameters

string $connectionName
string $sql
array $bindings
Throwable $previous

Return Value

string

in QueryException at line 82
protected string formatConnectionDetails()

Format the connection details for the error message.

Return Value

string

in QueryException at line 111
string getConnectionName()

Get the connection name for the query.

Return Value

string

in QueryException at line 119
string getSql()

Get the SQL for the query.

Return Value

string

in QueryException at line 127
string getRawSql()

Get the raw SQL representation of the query with embedded bindings.

Return Value

string

in QueryException at line 137
array getBindings()

Get the bindings for the query.

Return Value

array

in QueryException at line 145
array getConnectionDetails()

Get information about the connection such as host, port, database, etc.

Return Value

array

at line 24
UniqueConstraintViolationException setIndex(string|null $index)

Set the unique index which caused the violation.

Parameters

string|null $index

Return Value

UniqueConstraintViolationException

at line 36
UniqueConstraintViolationException setColumns(array $columns)

Set the columns that caused the violation.

Parameters

array $columns

Return Value

UniqueConstraintViolationException