I am not an expert in PHP, but looking at the Github source code, I found that the updateEntity function always forces the use of ETag , i.e. the function forces a conditional update:
public function updateEntity($table, $entity, $options = null) { return $this->_putOrMergeEntityImpl( $table, $entity, Resources::HTTP_PUT, true, $options ); }
Based on the documentation here :
If the ETag is different from the request specified in the update, the update operation completes with status code 412 (Prerequisite Failed). This error indicates that the object has been modified to the server since it was restored. To resolve this error, the object again and reissue the request.
To force an unconditional update operation, set the If-Match header value to the wildcard character (*) in the request. Passing this value for the operation will override the default concurrency optimization and ignore any mismatch of ETag values.
If the Etag value does not match, you will get the 412 error you get.
I would suggest using the insertOrReplaceEntity operation instead of the insertOrReplaceEntity operation, since it would create an entity if it does not exist, otherwise it would update it. Also looking at the code, this one does not use ETag .
public function insertOrReplaceEntity($table, $entity, $options = null) { return $this->_putOrMergeEntityImpl( $table, $entity, Resources::HTTP_PUT, false, $options ); }
Pay attention to the 4th parameter in both functions. This is the one that forces the use of ETag. In updateEntity it is set to true , and in insertOrReplaceEntity set to false .