API Documentation

Zend/Validate/Db/Abstract.php

Show: inherited
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-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Validate  
Version
$Id: Abstract.php 24594 2012-01-05 21:27:01Z matthew $  

\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-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Used_by
\Zend_Validate_Db_NoRecordExists  
Used_by
\Zend_Validate_Db_RecordExists  
Uses
\Zend_Validate_Abstract  

Constants

Constant  ERROR_NO_RECORD_FOUND = 'noRecordFound'

Error constants

Constant  ERROR_RECORD_FOUND = 'recordFound'

Properties

Propertyprotected\unknown_type  $_adapter= 'null'

Database adapter to use. If null isValid() will use Zend_Db::getInstance instead

Default valuenullDetails
Type
\unknown_type
Propertyprotectedmixed  $_exclude= 'null'

Default valuenullDetails
Type
mixed
Propertyprotectedstring  $_field= ''''

Default value''Details
Type
string
Propertyprotectedarray  $_messageTemplates= 'array( self::ERROR_NO_RECORD_FOUND => "No record matching '%value%' was found"'

Message templates
Default valuearray( self::ERROR_NO_RECORD_FOUND => "No record matching '%value%' was found"Details
Type
array
Propertyprotectedstring  $_schema= 'null'

Default valuenullDetails
Type
string
Propertyprotected\Zend_Db_Select  $_select= ''

Select object to use. can be set, or will be auto-generated

Details
Type
\Zend_Db_Select
Propertyprotectedstring  $_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
Name Type Description
$options array|\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
Name Type Description
$value String
Returns
Type Description
Array when matches are found.
methodpublicgetAdapter( ) : \Zend_Db_Adapter

Returns the set adapter

Returns
Type Description
\Zend_Db_Adapter
methodpublicgetExclude( ) : string|array

Returns the set exclude clause

Returns
Type Description
string|array
methodpublicgetField( ) : string|array

Returns the set field

Returns
Type Description
string|array
methodpublicgetSchema( ) : string

Returns the set schema

Returns
Type Description
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
Type Description
\Zend_Db_Select The Select object which will be used
methodpublicgetTable( ) : string

Returns the set table

Returns
Type Description
string
methodpublicsetAdapter( \Zend_Db_Adapter_Abstract $adapter ) : \Zend_Validate_Db_Abstract

Sets a new database adapter

Parameters
Name Type Description
$adapter \Zend_Db_Adapter_Abstract
Returns
Type Description
\Zend_Validate_Db_Abstract
methodpublicsetExclude( string|array $exclude ) : \Zend_Validate_Db_Abstract

Sets a new exclude clause

Parameters
Name Type Description
$exclude string|array
Returns
Type Description
\Zend_Validate_Db_Abstract
methodpublicsetField( string $field ) : \Zend_Validate_Db_Abstract

Sets a new field

Parameters
Name Type Description
$field string
Returns
Type Description
\Zend_Validate_Db_Abstract
methodpublicsetSchema( string $schema ) : \Zend_Validate_Db_Abstract

Sets a new schema

Parameters
Name Type Description
$schema string
Returns
Type Description
\Zend_Validate_Db_Abstract
methodpublicsetSelect( \Zend_Db_Select $select ) : \Zend_Validate_Db_Abstract

Sets the select object to be used by the validator

Parameters
Name Type Description
$select \Zend_Db_Select
Returns
Type Description
\Zend_Validate_Db_Abstract
methodpublicsetTable( string $table ) : \Zend_Validate_Db_Abstract

Sets a new table

Parameters
Name Type Description
$table string
Returns
Type Description
\Zend_Validate_Db_Abstract
Documentation was generated by DocBlox 0.15.1.