Validate/Db/Abstract.php
Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled
with this package in the file LICENSE.txt.
It is also available through the world-wide-web at this URL:
http://framework.zend.com/license/new-bsd
If you did not receive a copy of the license and are unable to
obtain it through the world-wide-web, please send an email
to [email protected] so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Validate
- Version
- $Id$
\Zend_Validate_Db_Abstract
Package: Zend_Validate
Class for Database record validation
- Parent(s)
- \Zend_Validate_Abstract
- Children
- \Zend_Validate_Db_NoRecordExists
- \Zend_Validate_Db_RecordExists
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Uses
Constants
Properties
\unknown_type $_adapter = null
Database adapter to use. If null isValid() will use Zend_Db::getInstance instead
Default value
null
Details- Type
- \unknown_type
array $_messageTemplates = array(self::ERROR_NO_RECORD_FOUND => "No record matching '%value%' was found", self::ERROR_RECORD_FOUND => "A record matching '%value%' was found")
Message templates
Default value
array(self::ERROR_NO_RECORD_FOUND => "No record matching '%value%' was found", self::ERROR_RECORD_FOUND => "A record matching '%value%' was found")
Details- Type
- array
\Zend_Db_Select $_select
Select object to use. can be set, or will be auto-generated
Details
- Type
- \Zend_Db_Select
Methods
__construct(array | \Zend_Config $options) : void
Provides basic configuration for use with Zend_Validate_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
ParametersName | Type | Description |
---|---|---|
$options | array | \Zend_Config | Options to use for this validator |
_query(String $value) : Array
Run query and returns matches, or null if no matches are found.
Parameters
Returns
Name | Type | Description |
---|---|---|
$value | String |
Type | Description |
---|---|
Array | when matches are found. |
getSelect() : \Zend_Db_Select
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.
ReturnsType | Description |
---|---|
\Zend_Db_Select | The Select object which will be used |
setAdapter(\Zend_Db_Adapter_Abstract $adapter) : \Zend_Validate_Db_Abstract
Sets a new database adapter
Parameters
Returns
Name | Type | Description |
---|---|---|
$adapter | \Zend_Db_Adapter_Abstract |
Type | Description |
---|---|
\Zend_Validate_Db_Abstract |
setExclude(string | array $exclude) : \Zend_Validate_Db_Abstract
Sets a new exclude clause
Parameters
Returns
Name | Type | Description |
---|---|---|
$exclude | string | array |
Type | Description |
---|---|
\Zend_Validate_Db_Abstract |
setField(string $field) : \Zend_Validate_Db_Abstract
Sets a new field
Parameters
Returns
Name | Type | Description |
---|---|---|
$field | string |
Type | Description |
---|---|
\Zend_Validate_Db_Abstract |
setSchema(string $schema) : \Zend_Validate_Db_Abstract
Sets a new schema
Parameters
Returns
Name | Type | Description |
---|---|---|
$schema | string |
Type | Description |
---|---|
\Zend_Validate_Db_Abstract |
setSelect(\Zend_Db_Select $select) : \Zend_Validate_Db_Abstract
Sets the select object to be used by the validator
Parameters
Returns
Name | Type | Description |
---|---|---|
$select | \Zend_Db_Select |
Type | Description |
---|---|
\Zend_Validate_Db_Abstract |
setTable(string $table) : \Zend_Validate_Db_Abstract
Sets a new table
Parameters
Returns
Name | Type | Description |
---|---|---|
$table | string |
Type | Description |
---|---|
\Zend_Validate_Db_Abstract |