entity_extract_ids() should produce a NULL if the entity has no ID yet.

However, in hook_field_attach_form() with the product form, I get an empty string.

(Marking as major as it's going to cause problems with #1050872: Integrate with the Flag module, which is how I've encountered it.)

Files: 
CommentFileSizeAuthor
#4 1689538-4.null_ids.patch3.23 KBrszrama
PASSED: [[SimpleTest]]: [MySQL] 3,587 pass(es).
[ View ]
#2 1689538-2.null_ids.patch2.52 KBrszrama
FAILED: [[SimpleTest]]: [MySQL] 3,588 pass(es), 1 fail(s), and 0 exception(s).
[ View ]

Comments

I'm guessing this affects all our entity types then; just need to look in the create method of our controllers to fix 'em.

I don't think anything in Commerce itself is so finicky as to expect NULL vs. ''. I wonder why the code reading this stuff isn't just using empty(). : ?

Status:Active» Needs review
StatusFileSize
new2.52 KB
FAILED: [[SimpleTest]]: [MySQL] 3,588 pass(es), 1 fail(s), and 0 exception(s).
[ View ]

Get 'em, test bot.

Status:Needs review» Needs work

The last submitted patch, 1689538-2.null_ids.patch, failed testing.

Priority:Major» Normal
Status:Needs work» Needs review
StatusFileSize
new3.23 KB
PASSED: [[SimpleTest]]: [MySQL] 3,587 pass(es).
[ View ]

Meh, that was a silly assertion.

Status:Needs review» Fixed

I don't see any place in Commerce where we make any assertions against IDs stronger than ==, so NULL or '' won't matter. Going to go ahead and commit the patch in #4.

Status:Fixed» Closed (fixed)

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