324. Class

324.1. Zend\Validator\Db\AbstractDb

Class for Database record validation

324.1.1. Methods

324.1.1.1. __construct

__construct()

Provides basic configuration for use with ZendValidatorDb 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

Parameters:array|Traversable|DbSelect – Options to use for this validator
Throws ZendValidatorExceptionInvalidArgumentException:
 

324.1.1.2. getAdapter

getAdapter()

Returns the set adapter

Return type:DbAdapter

324.1.1.3. setAdapter

setAdapter()

Sets a new database adapter

Parameters:DbAdapter
Return type:self Provides a fluent interface

324.1.1.4. getExclude

getExclude()

Returns the set exclude clause

Return type:string|array

324.1.1.5. setExclude

setExclude()

Sets a new exclude clause

Parameters:string|array
Return type:self Provides a fluent interface

324.1.1.6. getField

getField()

Returns the set field

Return type:string|array

324.1.1.7. setField

setField()

Sets a new field

Parameters:string
Return type:AbstractDb

324.1.1.8. getTable

getTable()

Returns the set table

Return type:string

324.1.1.9. setTable

setTable()

Sets a new table

Parameters:string
Return type:self Provides a fluent interface

324.1.1.10. getSchema

getSchema()

Returns the set schema

Return type:string

324.1.1.11. setSchema

setSchema()

Sets a new schema

Parameters:string
Return type:self Provides a fluent interface

324.1.1.12. setSelect

setSelect()

Sets the select object to be used by the validator

Parameters:DbSelect
Return type:self Provides a fluent interface

324.1.1.13. getSelect

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.

Return type:DbSelect The Select object which will be used

324.1.1.14. query

query()

Run query and returns matches, or null if no matches are found.

Parameters:string
Return type:array when matches are found.

324.1.2. Constants

324.1.2.1. ERROR_NO_RECORD_FOUND

Error constants

324.1.2.2. ERROR_RECORD_FOUND