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 [email protected] 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_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
- Parent(s)
- \Zend_Cloud_DocumentService_Adapter_AbstractAdapter
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Constants
DOCUMENT_CLASS
= 'document_class'
DOCUMENTSET_CLASS
= 'documentset_class'
QUERY_CLASS
= 'query_class'
HTTP_ADAPTER
= 'http_adapter'- Inherited_from
- \Zend_Cloud_DocumentService_Adapter::HTTP_ADAPTER
- Inherited_from
- \Zend_Cloud_DocumentService_Adapter_AbstractAdapter::HTTP_ADAPTER
Properties

string $_documentClass = 'Zend_Cloud_DocumentService_Document'Class to utilize for new document objects
Inherited from: \Zend_Cloud_DocumentService_Adapter_AbstractAdapter::$$_documentClass'Zend_Cloud_DocumentService_Document'Details- Type
- string
- Inherited_from
- \Zend_Cloud_DocumentService_Adapter_AbstractAdapter::$$_documentClass

string $_documentSetClass = 'Zend_Cloud_DocumentService_DocumentSet'Class to utilize for new document set objects
Inherited from: \Zend_Cloud_DocumentService_Adapter_AbstractAdapter::$$_documentSetClass'Zend_Cloud_DocumentService_DocumentSet'Details- Type
- string
- Inherited_from
- \Zend_Cloud_DocumentService_Adapter_AbstractAdapter::$$_documentSetClass

string $_queryClass = 'Zend_Cloud_DocumentService_Adapter_SimpleDb_Query'Class to utilize for new query objects
'Zend_Cloud_DocumentService_Adapter_SimpleDb_Query'Details- Type
- string
Methods

__construct(array | \Zend_Config $options = array()) : voidConstructor
| Name | Type | Description |
|---|---|---|
| $options | array | \Zend_Config |

_getDocumentFromArray(array $document) : \Zend_Cloud_DocumentService_DocumentCreate suitable document from array of fields
| Name | Type | Description |
|---|---|---|
| $document | array |
| Type | Description |
|---|---|
| \Zend_Cloud_DocumentService_Document |

_getDocumentSetFromResultSet(\Zend_Service_Amazon_SimpleDb_Page $resultSet, bool $returnDocs = true) : \Zend_Cloud_DocumentService_DocumentSetCreate a DocumentSet from a SimpleDb resultset
| Name | Type | Description |
|---|---|---|
| $resultSet | \Zend_Service_Amazon_SimpleDb_Page | |
| $returnDocs | bool |
| Type | Description |
|---|---|
| \Zend_Cloud_DocumentService_DocumentSet |

_makeAttributes(string $name, array $attributes) : arrayConvert array of key-value pairs to array of Amazon attributes
| Name | Type | Description |
|---|---|---|
| $name | string | |
| $attributes | array |
| Type | Description |
|---|---|
| array |

_resolveAttributes(array $attributes, $returnDocument = false) : arrayConvert array of Amazon attributes to array of key-value pairs
| Name | Type | Description |
|---|---|---|
| $attributes | array | |
| $returnDocument |
| Type | Description |
|---|---|
| array |

createCollection(string $name, array $options = null) : voidCreate collection.
| Name | Type | Description |
|---|---|---|
| $name | string | |
| $options | array |

deleteCollection(string $name, array $options = null) : voidDelete collection.
| Name | Type | Description |
|---|---|---|
| $name | string | |
| $options | array |

deleteDocument(string $collectionName, mixed $document, array $options = null) : booleanDelete document.
| Name | Type | Description |
|---|---|---|
| $collectionName | string | Collection from which to delete document |
| $document | mixed | Document ID or Document object. |
| $options | array |
| Type | Description |
|---|---|
| boolean |

fetchDocument(string $collectionName, mixed $documentId, array $options = null) : \Zend_Cloud_DocumentService_DocumentFetch single document by ID
Will return false if the document does not exist
| Name | Type | Description |
|---|---|---|
| $collectionName | string | Collection name |
| $documentId | mixed | Document ID, adapter-dependent |
| $options | array |
| Type | Description |
|---|---|
| \Zend_Cloud_DocumentService_Document |

getClient() : \Zend_Service_Amazon_SimpleDbGet the concrete service client
| Type | Description |
|---|---|
| \Zend_Service_Amazon_SimpleDb |

getDocumentClass() : stringGet the class for document objects
Inherited from: \Zend_Cloud_DocumentService_Adapter_AbstractAdapter::getDocumentClass()| Type | Description |
|---|---|
| string |

getDocumentSetClass() : stringGet the class for document set objects
Inherited from: \Zend_Cloud_DocumentService_Adapter_AbstractAdapter::getDocumentSetClass()| Type | Description |
|---|---|
| string |

getQueryClass() : stringGet the class for query objects
Inherited from: \Zend_Cloud_DocumentService_Adapter_AbstractAdapter::getQueryClass()| Type | Description |
|---|---|
| string |

insertDocument(string $collectionName, array | \Zend_Cloud_DocumentService_Document $document, array $options = null) : voidInsert document
| Name | Type | Description |
|---|---|---|
| $collectionName | string | Collection into which to insert document |
| $document | array | \Zend_Cloud_DocumentService_Document | |
| $options | array |

listCollections(array $options = null) : arrayList collections.
| Name | Type | Description |
|---|---|---|
| $options | array |
| Type | Description |
|---|---|
| array |

listDocuments(string $collectionName, array | null $options = null) : \Zend_Cloud_DocumentService_DocumentSetList documents
Returns a key/value array of document names to document objects.
| Name | Type | Description |
|---|---|---|
| $collectionName | string | Name of collection for which to list documents |
| $options | array | null |
| Type | Description |
|---|---|
| \Zend_Cloud_DocumentService_DocumentSet |

query(string $collectionName, string $query, array $options = null) : arrayQuery for documents stored in the document service.
If a string is passed in $query, the query string will be passed directly to the service.
| Name | Type | Description |
|---|---|---|
| $collectionName | string | Collection name |
| $query | string | |
| $options | array |
| Type | Description |
|---|---|
| array | Zend_Cloud_DocumentService_DocumentSet |

replaceDocument(string $collectionName, array | \Zend_Cloud_DocumentService_Document $document, array $options = null) : voidReplace an existing document with a new version
| Name | Type | Description |
|---|---|---|
| $collectionName | string | |
| $document | array | \Zend_Cloud_DocumentService_Document | |
| $options | array |

select(string $fields = null) : \Zend_Cloud_DocumentService_Adapter_SimpleDb_QueryCreate query statement
| Name | Type | Description |
|---|---|---|
| $fields | string |
| Type | Description |
|---|---|
| \Zend_Cloud_DocumentService_Adapter_SimpleDb_Query |

setDocumentClass(string $class) : \Zend_Cloud_DocumentService_Adapter_AbstractAdapterSet the class for document objects
Inherited from: \Zend_Cloud_DocumentService_Adapter_AbstractAdapter::setDocumentClass()| Name | Type | Description |
|---|---|---|
| $class | string |
| Type | Description |
|---|---|
| \Zend_Cloud_DocumentService_Adapter_AbstractAdapter |

setDocumentSetClass(string $class) : \Zend_Cloud_DocumentService_Adapter_AbstractAdapterSet the class for document set objects
Inherited from: \Zend_Cloud_DocumentService_Adapter_AbstractAdapter::setDocumentSetClass()| Name | Type | Description |
|---|---|---|
| $class | string |
| Type | Description |
|---|---|
| \Zend_Cloud_DocumentService_Adapter_AbstractAdapter |

setQueryClass(string $class) : \Zend_Cloud_DocumentService_Adapter_AbstractAdapterSet the query class for query objects
Inherited from: \Zend_Cloud_DocumentService_Adapter_AbstractAdapter::setQueryClass()| Name | Type | Description |
|---|---|---|
| $class | string |
| Type | Description |
|---|---|
| \Zend_Cloud_DocumentService_Adapter_AbstractAdapter |

updateDocument(string $collectionName, mixed | \Zend_Cloud_DocumentService_Document $documentId, array | \Zend_Cloud_DocumentService_Document $fieldset = null, array $options = null) : booleanUpdate 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.
| 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 |
| Type | Description |
|---|---|
| boolean |