Example #1
0
 /**
  * Resolve table values to attributes
  *
  * @param  \Zend\Service\WindowsAzure\Storage\TableEntity $entity
  * @return array
  */
 protected function _resolveAttributes(\Zend\Service\WindowsAzure\Storage\TableEntity $entity)
 {
     $result = array();
     foreach ($entity->getAzureValues() as $attr) {
         $result[$attr->Name] = $attr->Value;
     }
     return $result;
 }
Example #2
0
 /**
  * Generate Azure representation from entity (creates atompub markup from properties)
  *
  * @param TableEntity $entity
  * @return string
  */
 protected function _generateAzureRepresentation(TableEntity $entity = null)
 {
     // Generate Azure representation from entity
     $azureRepresentation = array();
     $azureValues = $entity->getAzureValues();
     foreach ($azureValues as $azureValue) {
         $value = array();
         $value[] = '<d:' . $azureValue->Name;
         if ($azureValue->Type != '') {
             $value[] = ' m:type="' . $azureValue->Type . '"';
         }
         if ($azureValue->Value === null) {
             $value[] = ' m:null="true"';
         }
         $value[] = '>';
         if ($azureValue->Value !== null) {
             if (strtolower($azureValue->Type) == 'edm.boolean') {
                 $value[] = $azureValue->Value == true ? '1' : '0';
             } else {
                 $value[] = htmlspecialchars($azureValue->Value);
             }
         }
         $value[] = '</d:' . $azureValue->Name . '>';
         $azureRepresentation[] = implode('', $value);
     }
     return implode('', $azureRepresentation);
 }