Class RecordExists

Summary

Fully Qualified Name: Laminas\Validator\Db\RecordExists
Extends: AbstractDb

Description

Confirms a record exists in a table.

Methods

Name Description Defined By
__construct() Provides basic configuration for use with Laminas\Validator\Db Validators Setting $exclude allows a single record to be excluded from matching. AbstractDb
__get() Magic function returns the value of the requested property, if and only if it is the value or a message variable. AbstractValidator
__invoke() Invoke as command AbstractValidator
getAdapter() Returns the set adapter AbstractDb
getDefaultTranslator() Get default translation object for all validate objects AbstractValidator
getDefaultTranslatorTextDomain() Get default translation text domain for all validate objects AbstractValidator
getExclude() Returns the set exclude clause AbstractDb
getField() Returns the set field AbstractDb
getMessageLength() Returns the maximum allowed message length AbstractValidator
getMessageTemplates() Returns the message templates from the validator AbstractValidator
getMessageVariables() Returns an array of the names of variables that are used in constructing validation failure messages AbstractValidator
getMessages() Returns array of validation failure messages AbstractValidator
getOption() Returns an option AbstractValidator
getOptions() Returns all available options AbstractValidator
getSchema() Returns the set schema AbstractDb
getSelect() Gets the select object to be used by the validator. AbstractDb
getTable() Returns the set table AbstractDb
getTranslator() Return translation object AbstractValidator
getTranslatorTextDomain() Return the translation text domain AbstractValidator
hasDefaultTranslator() Is there a default translation object set? AbstractValidator
hasTranslator() Does this validator have its own specific translator? AbstractValidator
isTranslatorEnabled() Is translation enabled? AbstractValidator
isValid() RecordExists
isValueObscured() Retrieve flag indicating whether or not value should be obfuscated in messages AbstractValidator
setAdapter() Sets a new database adapter AbstractDb
setDefaultTranslator() Set default translation object for all validate objects AbstractValidator
setDefaultTranslatorTextDomain() Set default translation text domain for all validate objects AbstractValidator
setExclude() Sets a new exclude clause AbstractDb
setField() Sets a new field AbstractDb
setMessage() Sets the validation failure message template for a particular key AbstractValidator
setMessageLength() Sets the maximum allowed message length AbstractValidator
setMessages() Sets validation failure message templates given as an array, where the array keys are the message keys, and the array values are the message template strings. AbstractValidator
setOptions() Sets one or multiple options AbstractValidator
setSchema() Sets a new schema AbstractDb
setSelect() Sets the select object to be used by the validator AbstractDb
setTable() Sets a new table AbstractDb
setTranslator() Set translation object AbstractValidator
setTranslatorEnabled() Indicate whether or not translation should be enabled AbstractValidator
setTranslatorTextDomain() Set translation text domain AbstractValidator
setValueObscured() Set flag indicating whether or not value should be obfuscated in messages AbstractValidator

Method Details

__construct()

Provides basic configuration for use with Laminas\Validator\Db Validators Setting $exclude allows a single record to be excluded from matching.

Exclude can either be a String containing a where clause, or an array with field and value keys to define the where clause added to the sql. A database adapter may optionally be supplied to avoid using the registered default adapter.

The following option keys are supported: 'table' => The database table to validate against 'schema' => The schema keys 'field' => The field to check for a match 'exclude' => An optional where clause or field/value pair to exclude from the query 'adapter' => An optional database adapter to use

Parameter Name Type Description
$options array|\Traversable|\Select Options

Returns:

__get()

Magic function returns the value of the requested property, if and only if it is the value or a message variable.

Parameter Name Type Description
$property string

Returns: mixed

__invoke()

Invoke as command

Parameter Name Type Description
$value mixed

Returns: bool

getAdapter()

Returns the set adapter

Returns: \DbAdapter

getDefaultTranslator()

Get default translation object for all validate objects

Returns: \Translator\TranslatorInterface|null

getDefaultTranslatorTextDomain()

Get default translation text domain for all validate objects

Returns: string

getExclude()

Returns the set exclude clause

Returns: string|array

getField()

Returns the set field

Returns: string|array

getMessageLength()

Returns the maximum allowed message length

Returns: int

getMessageTemplates()

Returns the message templates from the validator

Returns: array

getMessageVariables()

Returns an array of the names of variables that are used in constructing validation failure messages

Returns: array

getMessages()

Returns array of validation failure messages

Returns: array

getOption()

Returns an option

Parameter Name Type Description
$option string Option

Returns: mixed Returned option

getOptions()

Returns all available options

Returns: array Array with all available options

getSchema()

Returns the set schema

Returns: string

getSelect()

Gets the select object to be used by the validator.

If no select object was supplied to the constructor, then it will auto-generate one from the given table, schema, field, and adapter options.

Returns: \Select The Select object which will be used

getTable()

Returns the set table

Returns: string

getTranslator()

Return translation object

Returns: \Translator\TranslatorInterface|null

getTranslatorTextDomain()

Return the translation text domain

Returns: string

hasDefaultTranslator()

Is there a default translation object set?

Returns: bool

hasTranslator()

Does this validator have its own specific translator?

Returns: bool

isTranslatorEnabled()

Is translation enabled?

Returns: bool

isValid()

Parameter Name Type Description
$value

Returns: void

isValueObscured()

Retrieve flag indicating whether or not value should be obfuscated in messages

Returns: bool

setAdapter()

Sets a new database adapter

Parameter Name Type Description
$adapter \DbAdapter

Returns: self Provides a fluent interface

setDefaultTranslator()

Set default translation object for all validate objects

Parameter Name Type Description
$translator \Translator\TranslatorInterface|null
$textDomain string (optional)

Returns: void

setDefaultTranslatorTextDomain()

Set default translation text domain for all validate objects

Parameter Name Type Description
$textDomain string

Returns: void

setExclude()

Sets a new exclude clause

Parameter Name Type Description
$exclude string|array

Returns: $this Provides a fluent interface

setField()

Sets a new field

Parameter Name Type Description
$field string

Returns: $this

setMessage()

Sets the validation failure message template for a particular key

Parameter Name Type Description
$messageString string
$messageKey string OPTIONAL

Returns: $this Provides a fluent interface

setMessageLength()

Sets the maximum allowed message length

Parameter Name Type Description
$length int

Returns:

setMessages()

Sets validation failure message templates given as an array, where the array keys are the message keys, and the array values are the message template strings.

Parameter Name Type Description
$messages array

Returns: $this

setOptions()

Sets one or multiple options

Parameter Name Type Description
$options array|\Traversable Options

Returns: $this Provides fluid interface

setSchema()

Sets a new schema

Parameter Name Type Description
$schema string

Returns: $this Provides a fluent interface

setSelect()

Sets the select object to be used by the validator

Parameter Name Type Description
$select \Select

Returns: $this Provides a fluent interface

setTable()

Sets a new table

Parameter Name Type Description
$table string

Returns: $this Provides a fluent interface

setTranslator()

Set translation object

Parameter Name Type Description
$translator \Translator\TranslatorInterface|null
$textDomain string (optional)

Returns: $this

setTranslatorEnabled()

Indicate whether or not translation should be enabled

Parameter Name Type Description
$flag bool

Returns: $this

setTranslatorTextDomain()

Set translation text domain

Parameter Name Type Description
$textDomain string

Returns: $this

setValueObscured()

Set flag indicating whether or not value should be obfuscated in messages

Parameter Name Type Description
$flag bool

Returns: $this

Top