/**
  * {@inheritDoc}
  */
 public function insert($storageName, $key, array $data)
 {
     $entity = $this->createEntity($key, $data);
     try {
         $this->client->insertEntity($storageName, $entity);
     } catch (ServiceException $e) {
         if ($e->getCode() == 404) {
             $this->client->createTable($storageName);
         } else {
             throw new StorageException("Could not save entity in table, WindowsAzure SDK client reported error: " . $e->getMessage(), $e->getCode(), $e);
         }
     }
 }
Exemplo n.º 2
0
 /**
  * Assert table exists in Storage
  *
  * @return mixed
  */
 protected function assertTables()
 {
     try {
         // Create table.
         $this->tableProxy->createTable(self::TABLE_AGGREGATION);
     } catch (ServiceException $e) {
         if ($e->getCode() == 409) {
             return;
         }
         $code = $e->getCode();
         $error_message = $e->getMessage();
         echo $code . ": " . $error_message . "<br />";
     }
 }