Table Entity can not be updated

Aug 12, 2009 at 8:38 AM

Hi,

I can not update my table entity. The code is as it is described in Getting Started Page.

This is error message:

Fatal error: Uncaught exception 'Microsoft_Azure_Exception' with message 'One of the request inputs is not valid.
RequestId:838724c8-0680-4699-80cd-d5e6436519b2 Time:2009-08-12T08:21:30.5059622Z' in \Microsoft\Azure\Storage\Table.php:827
Stack trace: #0 \Microsoft\Azure\Storage\Table.php(728): Microsoft_Azure_Storage_Table->changeEntity('PUT', 'task', Object(SampleEntity), false) #1
editTask1.php(32): Microsoft_Azure_Storage_Table->updateEntity('task', Object(SampleEntity)) #2 {main} thrown in \Microsoft\Azure\Storage\Table.php on line 827

Any suggestions! 

 

 

 

 

Coordinator
Aug 12, 2009 at 9:49 AM
  • Are you working with development or live storage?
  • Did inserting the entity work?
Aug 12, 2009 at 10:48 AM

Thanks for you reply!

I am using  live storage.

Insert, delete, and retrieve are working fine, only update is problem.

By the way, I created my  SampleEntity with Microsoft_Azure_Storage_DynamicTableEntity classs.

 

 

Coordinator
Aug 12, 2009 at 12:47 PM

Would it be possible to post some code?

Aug 12, 2009 at 3:56 PM

Sure!  Code is like the following. I have already inserted data into key 1 row 1. 

    $storageClient = new Microsoft_Azure_Storage_Table($url,$account,$key );

   class SampleEntity extends Microsoft_Azure_Storage_DynamicTableEntity
   {
      public $Name;
      public $Comment;
      public $Visible = false;   
   }

    $entity = $storageClient->retrieveEntityById($tableName, '1', '1', 'SampleEntity');
    $entity->Name = 'Edited Name';
    $entity->Comment = 'Edited Comment';
    $result = $storageClient->updateEntity($tableName, $entity);

Coordinator
Aug 13, 2009 at 6:13 AM

Can you try the following class definition instead?

class SampleEntity extends Microsoft_Azure_Storage_TableEntity
{
    /**
     * @azure Name
     */
    public $Name;
    
    /**
     * @azure Age
     */
    public $Comment;
    
    /**
     * @azure Visible Edm.Boolean
     */
    public $Visible = false;
}
class SampleEntity extends Microsoft_Azure_Storage_TableEntity
{
    /**
     * @azure Name
     */
    public $Name;
    
    /**
     * @azure Comment
     */
    public $Comment;
    
    /**
     * @azure Visible Edm.Boolean
     */
    public $Visible = false;
}

It is important to add the field comments as the PHP SDK for Windows Azure relies on this to determine various property names and their types.

May 13, 2010 at 9:46 AM
Edited May 13, 2010 at 10:31 AM

Hi,

I follow in the same way but still update not works properly !!!

$result = $storageClient->updateEntity($tableName, $entity);

Please help me why the above method not work ?

 

Also Bek , you say that the Insert, delete, and retrieve are working fine by you. So Can you Please help me about me another Issue where I not able to Retrive data through query.

Please visit my thread for know more details.

http://phpazure.codeplex.com/Thread/View.aspx?ThreadId=212519

Thanks

 

 

Coordinator
May 14, 2010 at 6:15 AM

Can you post your latest code?

May 14, 2010 at 10:04 AM

Hi Maartenba,

I use the following code for update table entity:-

    $siteConfig = new SiteConfigurations($PARTITION, $rowKey );
    
    $siteConfig->site_title = $_POST["site_title"];
    $siteConfig->site_url = $_POST["site_url"];
    $siteConfig->domain_name = $_POST["domain_name"];
    $siteConfig->record_per_page = $_POST['record_per_page'];   
    $siteConfig->active_status =true;

    $siteConfig = $StorageClient->updateEntity($tablename, $siteConfig);

 

I use the class definitions as following:

class SiteConfigurations extends Microsoft_WindowsAzure_Storage_TableEntity
{
    /*
     * Notice the Doctrine style comments, some of which,
     * such as $ImageType, have typing information.
     * Anything that doesn't have a type is stored as a string.
     */
    
    /**
     * @azure Site Title
     */
    public $site_title;
    
    /**
     * @azure Site Url
     */
    public $site_url;
    
    /**
     * @azure Author
     */
    public $domain_name;
    
    /**
     * @azure Record Per Page
     */
    public $record_per_page;
    

  /**
* @azure Active Status
*/

    public $active_status = false;
    
}// end of class

But I am not able to update the table entity, Please help me out for this.

Thanks

Coordinator
May 14, 2010 at 11:12 AM

Try replacing your class with:

class SiteConfigurations extends Microsoft_WindowsAzure_Storage_TableEntity
{
    /*
     * Notice the Doctrine style comments, some of which,
     * such as $ImageType, have typing information.
     * Anything that doesn't have a type is stored as a string.
     */
    
    /**
     * @azure SiteTitle
     */
    public $site_title;
    
    /**
     * @azure SiteUrl
     */
    public $site_url;
    
    /**
     * @azure Author
     */
    public $domain_name;
    
    /**
     * @azure RecordPerPage
     */
    public $record_per_page;
    

  /**
* @azure ActiveStatus
*/

    public $active_status = false;
    
}// end of class

 

The @azure tag should be constructed as follows: @azure <optional_column_name_on_storage> <type>. This means no additional spaces are allowed in there.

May 15, 2010 at 11:17 AM

Hi Maartenba!

Thanks for your help, My code was working fine now for update entity.

Thanks