Validate/Db/Abstract.php

Show: PublicProtectedPrivateinherited
Table of Contents
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 license@zend.com 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

>VConstant  ERROR_NO_RECORD_FOUND = 'noRecordFound'
Error constants
>VConstant  ERROR_RECORD_FOUND = 'recordFound'

Properties

>VPropertyprotected\unknown_type $_adapter = null
Database adapter to use. If null isValid() will use Zend_Db::getInstance instead
Default valuenullDetails
Type
\unknown_type
>VPropertyprotectedmixed $_exclude = null
Default valuenullDetails
Type
mixed
>VPropertyprotectedstring $_field = ''
Default value''Details
Type
string
>VPropertyprotectedarray $_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 valuearray(self::ERROR_NO_RECORD_FOUND => "No record matching '%value%' was found", self::ERROR_RECORD_FOUND => "A record matching '%value%' was found")Details
Type
array
>VPropertyprotectedstring $_schema = null
Default valuenullDetails
Type
string
>VPropertyprotected\Zend_Db_Select $_select
Select object to use. can be set, or will be auto-generated
Details
Type
\Zend_Db_Select
>VPropertyprotectedstring $_table = ''
Default value''Details
Type
string

Methods

methodpublic__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
Parameters
NameTypeDescription
$optionsarray | \Zend_Config

Options to use for this validator

methodprotected_query(String $value) : Array

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

Parameters
NameTypeDescription
$valueString
Returns
TypeDescription
Arraywhen matches are found.
methodpublicgetAdapter() : \Zend_Db_Adapter

Returns the set adapter

Returns
TypeDescription
\Zend_Db_Adapter
methodpublicgetExclude() : string | array

Returns the set exclude clause

Returns
TypeDescription
string | array
methodpublicgetField() : string | array

Returns the set field

Returns
TypeDescription
string | array
methodpublicgetSchema() : string

Returns the set schema

Returns
TypeDescription
string
methodpublicgetSelect() : \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.
Returns
TypeDescription
\Zend_Db_SelectThe Select object which will be used
methodpublicgetTable() : string

Returns the set table

Returns
TypeDescription
string
methodpublicsetAdapter(\Zend_Db_Adapter_Abstract $adapter) : \Zend_Validate_Db_Abstract

Sets a new database adapter

Parameters
NameTypeDescription
$adapter\Zend_Db_Adapter_Abstract
Returns
TypeDescription
\Zend_Validate_Db_Abstract
methodpublicsetExclude(string | array $exclude) : \Zend_Validate_Db_Abstract

Sets a new exclude clause

Parameters
NameTypeDescription
$excludestring | array
Returns
TypeDescription
\Zend_Validate_Db_Abstract
methodpublicsetField(string $field) : \Zend_Validate_Db_Abstract

Sets a new field

Parameters
NameTypeDescription
$fieldstring
Returns
TypeDescription
\Zend_Validate_Db_Abstract
methodpublicsetSchema(string $schema) : \Zend_Validate_Db_Abstract

Sets a new schema

Parameters
NameTypeDescription
$schemastring
Returns
TypeDescription
\Zend_Validate_Db_Abstract
methodpublicsetSelect(\Zend_Db_Select $select) : \Zend_Validate_Db_Abstract

Sets the select object to be used by the validator

Parameters
NameTypeDescription
$select\Zend_Db_Select
Returns
TypeDescription
\Zend_Validate_Db_Abstract
methodpublicsetTable(string $table) : \Zend_Validate_Db_Abstract

Sets a new table

Parameters
NameTypeDescription
$tablestring
Returns
TypeDescription
\Zend_Validate_Db_Abstract
Documentation was generated by phpDocumentor 2.2.0 .