API Documentation

Cloud/DocumentService/Adapter/SimpleDb.php

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-2011 Zend Technologies USA Inc. (http://www.zend.com)  
license
New BSD License  
package
Zend_Cloud  
subpackage
DocumentService  

\Zend_Cloud_DocumentService_Adapter_SimpleDb

SimpleDB adapter for document service.

Provides functionality surrounding setting classes for each of: - document objects - document set objects - query class objects

Extends from
\Zend_Cloud_DocumentService_Adapter_AbstractAdapter
category
Zend  
copyright
Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)  
license
New BSD License  
package
Zend_Cloud  
subpackage
DocumentService  

Constants

Constant  AWS_ACCESS_KEY = 'aws_accesskey'
Constant  AWS_SECRET_KEY = 'aws_secretkey'
Constant  ITEM_NAME = 'ItemName'
Constant  MERGE_OPTION = 'merge'
Constant  RETURN_DOCUMENTS = 'return_documents'
Constant  DEFAULT_QUERY_CLASS = 'Zend_Cloud_DocumentService_Adapter_SimpleDb_Query'

Properties

Propertyprotectedstring  $_queryClass= 'Zend_Cloud_DocumentService_Adapter_SimpleDb_Query'

Class to utilize for new query objects

Default valueZend_Cloud_DocumentService_Adapter_SimpleDb_QueryDetails
Type
string
Propertyprotected\Zend_Service_Amazon_SimpleDb  $_simpleDb= ''

SQS service instance.

Methods

methodpublic__construct( array|\Zend_Config $options = array ) : void

Constructor

Parameters
Name Type Description
$options array|\Zend_Config
methodprotected_getDocumentFromArray( array $document ) : \Zend_Cloud_DocumentService_Document

Create suitable document from array of fields

Parameters
Name Type Description
$document array
Returns
Type Description
\Zend_Cloud_DocumentService_Document
methodprotected_getDocumentSetFromResultSet( \Zend_Service_Amazon_SimpleDb_Page $resultSet, bool $returnDocs = true ) : \Zend_Cloud_DocumentService_DocumentSet

Create a DocumentSet from a SimpleDb resultset

Parameters
Name Type Description
$resultSet \Zend_Service_Amazon_SimpleDb_Page
$returnDocs bool
Returns
Type Description
\Zend_Cloud_DocumentService_DocumentSet
methodprotected_makeAttributes( string $name, array $attributes ) : array

Convert array of key-value pairs to array of Amazon attributes

Parameters
Name Type Description
$name string
$attributes array
Returns
Type Description
array
methodprotected_resolveAttributes( array $attributes,  $returnDocument = false ) : array

Convert array of Amazon attributes to array of key-value pairs

Parameters
Name Type Description
$attributes array
$returnDocument
Returns
Type Description
array
methodpubliccreateCollection( string $name, array $options = null ) : void

Create collection.

Parameters
Name Type Description
$name string
$options array
methodpublicdeleteCollection( string $name, array $options = null ) : void

Delete collection.

Parameters
Name Type Description
$name string
$options array
methodpublicdeleteDocument( string $collectionName, mixed $document, array $options = null ) : boolean

Delete document.

Parameters
Name Type Description
$collectionName string Collection from which to delete document
$document mixed Document ID or Document object.
$options array
Returns
Type Description
boolean
methodpublicfetchDocument( string $collectionName, mixed $documentId, array $options = null ) : \Zend_Cloud_DocumentService_Document

Fetch single document by ID

Will return false if the document does not exist

Parameters
Name Type Description
$collectionName string Collection name
$documentId mixed

Document ID, adapter-dependent

$options array
Returns
Type Description
\Zend_Cloud_DocumentService_Document
methodpublicgetClient( ) : \Zend_Service_Amazon_SimpleDb

Get the concrete service client

Returns
Type Description
\Zend_Service_Amazon_SimpleDb
methodpublicgetDocumentClass( ) : string

Get the class for document objects

Inherited from: \Zend_Cloud_DocumentService_Adapter_AbstractAdapter::getDocumentClass()
Returns
Type Description
string
methodpublicgetDocumentSetClass( ) : string

Get the class for document set objects

Inherited from: \Zend_Cloud_DocumentService_Adapter_AbstractAdapter::getDocumentSetClass()
Returns
Type Description
string
methodpublicgetQueryClass( ) : string

Get the class for query objects

Inherited from: \Zend_Cloud_DocumentService_Adapter_AbstractAdapter::getQueryClass()
Returns
Type Description
string
methodpublicinsertDocument( string $collectionName, array|\Zend_Cloud_DocumentService_Document $document, array $options = null ) : void

Insert document

Parameters
Name Type Description
$collectionName string Collection into which to insert document
$document array|\Zend_Cloud_DocumentService_Document
$options array
methodpubliclistCollections( array $options = null ) : array

List collections.

Parameters
Name Type Description
$options array
Returns
Type Description
array
methodpubliclistDocuments( string $collectionName, array|null $options = null ) : \Zend_Cloud_DocumentService_DocumentSet

List documents

Returns a key/value array of document names to document objects.

Parameters
Name Type Description
$collectionName string Name of collection for which to list documents
$options array|null
Returns
Type Description
\Zend_Cloud_DocumentService_DocumentSet
methodpublicquery( string $collectionName, string $query, array $options = null ) : array

Query for documents stored in the document service. If a string is passed in $query, the query string will be passed directly to the service.

Parameters
Name Type Description
$collectionName string Collection name
$query string
$options array
Returns
Type Description
array Zend_Cloud_DocumentService_DocumentSet
methodpublicreplaceDocument( string $collectionName, array|\Zend_Cloud_DocumentService_Document $document, array $options = null ) : void

Replace an existing document with a new version

Parameters
Name Type Description
$collectionName string
$document array|\Zend_Cloud_DocumentService_Document
$options array
methodpublicselect( string $fields = null ) : \Zend_Cloud_DocumentService_Adapter_SimpleDb_Query

Create query statement

Parameters
Name Type Description
$fields string
Returns
Type Description
\Zend_Cloud_DocumentService_Adapter_SimpleDb_Query
methodpublicsetDocumentClass( string $class ) : \Zend_Cloud_DocumentService_Adapter_AbstractAdapter

Set the class for document objects

Inherited from: \Zend_Cloud_DocumentService_Adapter_AbstractAdapter::setDocumentClass()
Parameters
Name Type Description
$class string
Returns
Type Description
\Zend_Cloud_DocumentService_Adapter_AbstractAdapter
methodpublicsetDocumentSetClass( string $class ) : \Zend_Cloud_DocumentService_Adapter_AbstractAdapter

Set the class for document set objects

Inherited from: \Zend_Cloud_DocumentService_Adapter_AbstractAdapter::setDocumentSetClass()
Parameters
Name Type Description
$class string
Returns
Type Description
\Zend_Cloud_DocumentService_Adapter_AbstractAdapter
methodpublicsetQueryClass( string $class ) : \Zend_Cloud_DocumentService_Adapter_AbstractAdapter

Set the query class for query objects

Inherited from: \Zend_Cloud_DocumentService_Adapter_AbstractAdapter::setQueryClass()
Parameters
Name Type Description
$class string
Returns
Type Description
\Zend_Cloud_DocumentService_Adapter_AbstractAdapter
methodpublicupdateDocument( string $collectionName, mixed|\Zend_Cloud_DocumentService_Document $documentId, array|\Zend_Cloud_DocumentService_Document $fieldset = null, array $options = null ) : boolean

Update document. The new document replaces the existing document.

Option 'merge' specifies to add all attributes (if true) or specific attributes ("attr" => true) instead of replacing them. By default, attributes are replaced.

Parameters
Name Type Description
$collectionName string
$documentId mixed|\Zend_Cloud_DocumentService_Document

Document ID, adapter-dependent

$fieldset array|\Zend_Cloud_DocumentService_Document Set of fields to update
$options array
Returns
Type Description
boolean
Documentation was generated by DocBlox 0.13.3.