hook_entity_info revision_id is not required(like commerce_product)

list($entity_id, $revision_id, $bundle) = entity_extract_ids($entity_type, $entity);
if(!isset($revision_id)) $revision_id = $entity_id;  // use entity_id as revision_id
CommentFileSizeAuthor
#3 1188932-revision_id-null.patch1.21 KBdawehner

Comments

dave reid’s picture

Priority: Critical » Normal
Status: Needs review » Postponed (maintainer needs more info)

In which case it should allow the module to store NULL in the database and work as designed. Is this not the case?

hibersh’s picture

Status: Postponed (maintainer needs more info) » Needs review

entity_extract_ids('commerce_product', $entity) return a NULL revision id, gotta error insert a null value in to table.
"commerce_product" is a entity type without revision.

dawehner’s picture

Priority: Normal » Major
StatusFileSize
new1.21 KB

You aren't allowed to use NULL in any kind of db_select/db_delete but you can use 0.

I think it's correct that entity_extract_ids return NULL for revision_id here.

@hibers
Needs review means that there is a patch.

With this patch it's possible to save terms on users.

dave reid’s picture

Status: Needs review » Fixed

d'oh! I double checked and Field API stores revision_id = entity_id in this case, so I slightly adjusted #3 to do that.
http://drupalcode.org/project/taxonomy_entity_index.git/commit/e3ff407

Automatically closed -- issue fixed for 2 weeks with no activity.