Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
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.)
Comment | File | Size | Author |
---|---|---|---|
#4 | 1689538-4.null_ids.patch | 3.23 KB | rszrama |
#2 | 1689538-2.null_ids.patch | 2.52 KB | rszrama |
Comments
Comment #1
rszrama CreditAttribution: rszrama commentedI'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(). : ?
Comment #2
rszrama CreditAttribution: rszrama commentedGet 'em, test bot.
Comment #4
rszrama CreditAttribution: rszrama commentedMeh, that was a silly assertion.
Comment #5
rszrama CreditAttribution: rszrama commentedI 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.