Class for Database record validation
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: | |
Sets a new database adapter
Parameters: | DbAdapter – |
---|---|
Return type: | self Provides a fluent interface |
Sets a new exclude clause
Parameters: | string|array – |
---|---|
Return type: | self Provides a fluent interface |
Sets a new table
Parameters: | string – |
---|---|
Return type: | self Provides a fluent interface |
Sets a new schema
Parameters: | string – |
---|---|
Return type: | self Provides a fluent interface |
Sets the select object to be used by the validator
Parameters: | DbSelect – |
---|---|
Return type: | self Provides a fluent interface |
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 |
---|
Run query and returns matches, or null if no matches are found.
Parameters: | string – |
---|---|
Return type: | array when matches are found. |