Cloud/DocumentService/Adapter/SimpleDb.php

Show: PublicProtectedPrivateinherited
Table of Contents
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_Cloud  
Subpackage
DocumentService  

\Zend_Cloud_DocumentService_Adapter_SimpleDb

Package: Zend_Cloud\DocumentService
SimpleDB adapter for document service.
Provides functionality surrounding setting classes for each of: - document objects - document set objects - query class objects
Parent(s)
\Zend_Cloud_DocumentService_Adapter_AbstractAdapter
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Constants

>VConstant  AWS_ACCESS_KEY = 'aws_accesskey'
>VConstant  AWS_SECRET_KEY = 'aws_secretkey'
>VConstant  ITEM_NAME = 'ItemName'
>VConstant  MERGE_OPTION = "merge"
>VConstant  RETURN_DOCUMENTS = "return_documents"
>VConstant  DEFAULT_QUERY_CLASS = 'Zend_Cloud_DocumentService_Adapter_SimpleDb_Query'

Properties

>VPropertyprotectedstring $_queryClass = 'Zend_Cloud_DocumentService_Adapter_SimpleDb_Query'
Class to utilize for new query objects
Default value'Zend_Cloud_DocumentService_Adapter_SimpleDb_Query'Details
Type
string
>VPropertyprotected\Zend_Service_Amazon_SimpleDb $_simpleDb
SQS service instance.

Methods

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

Constructor

Parameters
NameTypeDescription
$optionsarray | \Zend_Config
methodprotected_getDocumentFromArray(array $document) : \Zend_Cloud_DocumentService_Document

Create suitable document from array of fields

Parameters
NameTypeDescription
$documentarray
Returns
TypeDescription
\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
NameTypeDescription
$resultSet\Zend_Service_Amazon_SimpleDb_Page
$returnDocsbool
Returns
TypeDescription
\Zend_Cloud_DocumentService_DocumentSet
methodprotected_makeAttributes(string $name, array $attributes) : array

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

Parameters
NameTypeDescription
$namestring
$attributesarray
Returns
TypeDescription
array
methodprotected_resolveAttributes(array $attributes,  $returnDocument = false) : array

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

Parameters
NameTypeDescription
$attributesarray
$returnDocument
Returns
TypeDescription
array
methodpubliccreateCollection(string $name, array $options = null) : void

Create collection.

Parameters
NameTypeDescription
$namestring
$optionsarray
methodpublicdeleteCollection(string $name, array $options = null) : void

Delete collection.

Parameters
NameTypeDescription
$namestring
$optionsarray
methodpublicdeleteDocument(string $collectionName, mixed $document, array $options = null) : boolean

Delete document.

Parameters
NameTypeDescription
$collectionNamestring

Collection from which to delete document

$documentmixed

Document ID or Document object.

$optionsarray
Returns
TypeDescription
boolean
methodpublicfetchDocument(string $collectionName, mixed $documentId, array $options = null) : \Zend_Cloud_DocumentService_Document

Fetch single document by ID

Parameters
NameTypeDescription
$collectionNamestring

Collection name

$documentIdmixed

Document ID, adapter-dependent

$optionsarray
Returns
TypeDescription
\Zend_Cloud_DocumentService_Document
methodpublicgetClient() : \Zend_Service_Amazon_SimpleDb

Get the concrete service client

Returns
TypeDescription
\Zend_Service_Amazon_SimpleDb
methodpublicinsertDocument(string $collectionName, array | \Zend_Cloud_DocumentService_Document $document, array $options = null) : void

Insert document

Parameters
NameTypeDescription
$collectionNamestring

Collection into which to insert document

$documentarray | \Zend_Cloud_DocumentService_Document
$optionsarray
methodpubliclistCollections(array $options = null) : array

List collections.

Parameters
NameTypeDescription
$optionsarray
Returns
TypeDescription
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
NameTypeDescription
$collectionNamestring

Name of collection for which to list documents

$optionsarray | null
Returns
TypeDescription
\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
NameTypeDescription
$collectionNamestring

Collection name

$querystring
$optionsarray
Returns
TypeDescription
arrayZend_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
NameTypeDescription
$collectionNamestring
$documentarray | \Zend_Cloud_DocumentService_Document
$optionsarray
methodpublicselect(string $fields = null) : \Zend_Cloud_DocumentService_Adapter_SimpleDb_Query

Create query statement

Parameters
NameTypeDescription
$fieldsstring
Returns
TypeDescription
\Zend_Cloud_DocumentService_Adapter_SimpleDb_Query
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
NameTypeDescription
$collectionNamestring
$documentIdmixed | \Zend_Cloud_DocumentService_Document

Document ID, adapter-dependent

$fieldsetarray | \Zend_Cloud_DocumentService_Document

Set of fields to update

$optionsarray
Returns
TypeDescription
boolean
Documentation was generated by phpDocumentor 2.2.0 .