Ejemplo n.º 1
0
 protected function createStorageInstance()
 {
     $storageClient = null;
     if (TESTS_ZEND_SERVICE_WINDOWSAZURE_SESSIONHANDLER_RUNONPROD) {
         $storageClient = new Table(TESTS_ZEND_SERVICE_WINDOWSAZURE_TABLE_HOST_PROD, TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_ACCOUNT_PROD, TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_KEY_PROD, false, AbstractRetryPolicy::retryN(10, 250));
     } else {
         $storageClient = new Table(TESTS_ZEND_SERVICE_WINDOWSAZURE_TABLE_HOST_DEV, TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_ACCOUNT_DEV, TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_KEY_DEV, true, AbstractRetryPolicy::retryN(10, 250));
     }
     if (TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_USEPROXY) {
         $storageClient->setProxy(TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_USEPROXY, TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_PROXY, TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_PROXY_PORT, TESTS_ZEND_SERVICE_WINDOWSAZURE_STORAGE_PROXY_CREDENTIALS);
     }
     return $storageClient;
 }
Ejemplo n.º 2
0
 /**
  * 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.
  *
  * @param  string $collectionName Collection name
  * @param  string|\Zend\Cloud\DocumentService\Adapter\WindowsAzure\Query $query
  * @param  array $options
  * @return array|\Zend\Cloud\DocumentService\DocumentSet
  */
 public function query($collectionName, $query, $options = null)
 {
     try {
         if ($query instanceof \Zend\Cloud\DocumentService\Adapter\WindowsAzure\Query) {
             $entities = $this->_storageClient->retrieveEntities($query->assemble());
         } else {
             $entities = $this->_storageClient->retrieveEntities($collectionName, $query);
         }
         $documentClass = $this->getDocumentClass();
         $resultSet = array();
         foreach ($entities as $entity) {
             $resultSet[] = new $documentClass($this->_resolveAttributes($entity), array($entity->getPartitionKey(), $entity->getRowKey()));
         }
     } catch (WindowsAzureException\ExceptionInterface $e) {
         throw new Exception\RuntimeException('Error on document query: ' . $e->getMessage(), $e->getCode(), $e);
     }
     $setClass = $this->getDocumentSetClass();
     return new $setClass($resultSet);
 }