SimpleDB adapter for document service.

Provides functionality surrounding setting classes for each of:

  • document objects
  • document set objects
  • query class objects
category Zend
package Zend_Cloud
subpackage DocumentService
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License
inherited_from \Zend_Cloud_DocumentService_Adapter_AbstractAdapter

 Methods

Constructor

__construct(array $options = array()) : void

Parameters

$options

array

Validate an individual field name for well-formedness

_validateFieldKey(string $key) : void

Since Azure uses Atom, and fieldnames are included as part of XML element tag names, the field names must be valid XML names.

While we could potentially normalize names, this could also lead to conflict with other field names -- which we should avoid. As such, invalid field names will raise an exception.

Parameters

$key

string

Exceptions

\Zend_Cloud_DocumentService_Exception

Validate a document's fields for well-formedness

_validateFields(\Zend_Cloud_DocumentService_Document|array $document) : void

Since Azure uses Atom, and fieldnames are included as part of XML element tag names, the field names must be valid XML names.

Parameters

$document

\Zend_Cloud_DocumentService_Documentarray

Exceptions

\Zend_Cloud_DocumentService_Exception

Create collection.

createCollection(string $name, array $options = null) : boolean

Parameters

$name

string

$options

array

Returns

boolean

Delete collection.

deleteCollection(string $name, array $options = null) : boolean

Parameters

$name

string

$options

array

Returns

boolean

Delete document.

deleteDocument($collectionName, $documentId, array $options = null) : void

Parameters

$collectionName

$documentId

$options

array

Fetch single document by ID

fetchDocument(string $collectionName, mixed $documentId, array $options = null) : \Zend_Cloud_DocumentService_Document

Parameters

$collectionName

string

Collection name

$documentId

mixed

Document ID, adapter-dependent

$options

array

Returns

\Zend_Cloud_DocumentService_Document

Get the concrete service client

getClient() : \Zend_Service_WindowsAzure_Storage_Table

Returns

\Zend_Service_WindowsAzure_Storage_Table

Retrieve default partition key

getDefaultPartitionKey() : null | string

Returns

nullstring

Get the class for document objects

getDocumentClass() : string
Inherited

Returns

string

Get the class for document set objects

getDocumentSetClass() : string
Inherited

Returns

string

Get the class for query objects

getQueryClass() : string
Inherited

Returns

string

Insert document

insertDocument($collectionName, array|\Zend_Cloud_DocumentService_Document $document, array $options = null) : boolean

Parameters

$collectionName

$document

array\Zend_Cloud_DocumentService_Document

$options

array

Returns

boolean

List collections.

listCollections(array $options = null) : array

Parameters

$options

array

Returns

array

List all documents in a collection

listDocuments(string $collectionName, null|array $options = null) : \Zend_Cloud_DocumentService_DocumentSet

Parameters

$collectionName

string

$options

nullarray

Returns

\Zend_Cloud_DocumentService_DocumentSet

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.

query(string $collectionName, string|\Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query $query, array $options = null) : array

Parameters

$collectionName

string

Collection name

$query

string\Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query

$options

array

Returns

arrayZend_Cloud_DocumentService_DocumentSet

Replace document.

replaceDocument($collectionName, \Zend_Cloud_DocumentService_Document $document, array $options = null) : boolean

The new document replaces the existing document.

Parameters

$collectionName

$document

\Zend_Cloud_DocumentService_Document

$options

array

Returns

boolean

Create query statement

select($fields = null) : \Zend_Cloud_DocumentService_Query

Parameters

$fields

Returns

\Zend_Cloud_DocumentService_Query

Set the default partition key

setDefaultPartitionKey(string $key) : \Zend_Cloud_DocumentService_Adapter_WindowsAzure

Parameters

$key

string

Returns

\Zend_Cloud_DocumentService_Adapter_WindowsAzure

Set the class for document objects

setDocumentClass(string $class) : \Zend_Cloud_DocumentService_Adapter_AbstractAdapter
Inherited

Parameters

$class

string

Returns

\Zend_Cloud_DocumentService_Adapter_AbstractAdapter

Set the class for document set objects

setDocumentSetClass(string $class) : \Zend_Cloud_DocumentService_Adapter_AbstractAdapter
Inherited

Parameters

$class

string

Returns

\Zend_Cloud_DocumentService_Adapter_AbstractAdapter

Set the query class for query objects

setQueryClass(string $class) : \Zend_Cloud_DocumentService_Adapter_AbstractAdapter
Inherited

Parameters

$class

string

Returns

\Zend_Cloud_DocumentService_Adapter_AbstractAdapter

Update document.

updateDocument(string $collectionName, mixed|\Zend_Cloud_DocumentService_Document $documentId, $fieldset = null, array $options = null) : boolean

The new document is merged the existing document.

Parameters

$collectionName

string

$documentId

mixed\Zend_Cloud_DocumentService_Document

Document identifier or document contaiing updates

$fieldset

$options

array

Returns

boolean

Create suitable document from array of fields

_getDocumentFromArray(array $document, null|string $collectionName = null) : \Zend_Cloud_DocumentService_Document

Parameters

$document

array

$collectionName

nullstring

Collection to which this document belongs

Returns

\Zend_Cloud_DocumentService_Document

Resolve table values to attributes

_resolveAttributes(\Zend_Service_WindowsAzure_Storage_TableEntity $entity) : array

Parameters

$entity

\Zend_Service_WindowsAzure_Storage_TableEntity

Returns

array

Validate a composite key

_validateCompositeKey(array $key) : \throws

Parameters

$key

array

Returns

\throwsZend_Cloud_DocumentService_Exception

Validate a document identifier

_validateDocumentId(array|string $documentId, null|string $collectionName = false) : array

If the identifier is an array containing a valid partition and row key, returns it. If the identifier is a string:

  • if a default partition key is present, it creates an identifier using that and the provided document ID
  • if a collection name is provided, it will use that for the partition key
  • otherwise, it's invalid

Parameters

$documentId

arraystring

$collectionName

nullstring

Exceptions

\Zend_Cloud_DocumentService_Exception

Returns

array

Validate a partition or row key

_validateKey(string $key) : void

Parameters

$key

string

Exceptions

\Zend_Cloud_DocumentService_Exception

 Properties

 

Partition key to use by default when constructing document identifiers

$_defaultPartitionKey : string

Default

 

Class to utilize for new document objects

$_documentClass : string

Default

'Zend_Cloud_DocumentService_Document'
 

Class to utilize for new document set objects

$_documentSetClass : string

Default

'Zend_Cloud_DocumentService_DocumentSet'
 

Class to utilize for new query objects

$_queryClass : string

Default

'Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query'
inherited_from \Zend_Cloud_DocumentService_Adapter_AbstractAdapter::_queryClass
 

Class to utilize for new query objects

$_queryClass : string

Default

'Zend_Cloud_DocumentService_Query'
 

Azure service instance.

$_storageClient : \Zend_Service_WindowsAzure_Storage_Table

Default

 Constants

     

DEFAULT_HOST

DEFAULT_HOST = \Zend_Service_WindowsAzure_Storage::URL_CLOUD_TABLE 
 

DEFAULT_PARTITION_KEY

DEFAULT_PARTITION_KEY = "default_partition_key" 
 

DEFAULT_QUERY_CLASS

DEFAULT_QUERY_CLASS = 'Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query' 
 

DOCUMENTSET_CLASS

DOCUMENTSET_CLASS = 'documentset_class' 
 

DOCUMENT_CLASS

DOCUMENT_CLASS = 'document_class' 
 

HOST

HOST = "storage_host" 
 

PARTITION_KEY

PARTITION_KEY = 'PartitionKey' 
 

PROXY_CREDENTIALS

PROXY_CREDENTIALS = "storage_proxy_credentials" 
 

PROXY_HOST

PROXY_HOST = "storage_proxy_host" 
 

PROXY_PORT

PROXY_PORT = "storage_proxy_port" 
 

QUERY_CLASS

QUERY_CLASS = 'query_class' 
 

ROW_KEY

ROW_KEY = 'RowKey' 
 

TIMESTAMP_KEY

TIMESTAMP_KEY = "Timestamp" 
 

VERIFY_ETAG

VERIFY_ETAG = "verify_etag"