Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm getting the following error when trying to enable the commerce_coupon 2.x-dev module after having disabled it. Here is the error:
EntityMetadataWrapperException: Unknown data property coupon_count. in EntityStructureWrapper->getPropertyInfo() (line 335 of /drupal/sites/all/modules/entity/includes/entity.wrapper.inc).
Once I uninstalled everything and then reinstalled it worked fine, but it was frustrating to have to uninstall as I had already entered a few coupons.
Comment | File | Size | Author |
---|---|---|---|
#2 | commerce_coupon-missing-properties-2316899-2.patch | 520 bytes | andre4s_y |
Comments
Comment #1
deggertsen CreditAttribution: deggertsen commentedComment #2
andre4s_y CreditAttribution: andre4s_y commentedI am able to reproduce this bug.
Occured when admin try to enable the module.
This following functions get called:
Now, what is coupon_count property?
A property at commerce_discount entity.
Which is declared using function commerce_coupon_entity_property_info_alter() at commerce_coupon.info.inc.
So, why it is not available when admin try to enable the module?
Because the entity property info cache get flushed upon module disable process.
Solution:
Implements hook_enable which perform clearing entity property info cache upon module enable proccess => in order to get cache refreshed and hook_entity_property_info_alter() called.
I have created a patch. Please help to review. :)
Thank you.
Comment #4
dpolant CreditAttribution: dpolant commentedThanks for the fix - I committed this patch.