Adding a file license: admin/commerce/file-licenses/add throws the following exception, clean install of
Commerce 7.x-1.4, Entity API 7.x-1.0, Token 7.x-1.4, Drupal 7.19
EntityMetadataWrapperException: Unknown data property commerce_file_license_file. in EntityStructureWrapper->getPropertyInfo() (line 339 of /home/public_html/sites/all/modules/entity/includes/entity.wrapper.inc).

Comments

pierrepaul’s picture

Priority: Normal » Major

I can confirm this with commerce 7.15-dev and Entity API 7.x-1.0. No license are issued.

pierrepaul’s picture

Priority: Major » Critical

Switching the priority to critical, since the module doesn't work if it's not fixed/explained.

Anonymous’s picture

I am experiencing this issue as well--very frustrating.

The error readout I get is :

Location http://X.X.X.X/admin/commerce/orders/11/licenses?render=overlay&render=overlay
Referrer http://X.X.X.X/admin/commerce/orders/11/licenses?render=overlay
Message EntityMetadataWrapperException: Invalid data value given. Be sure it matches the required data type and format. in EntityMetadataWrapper->set() (line 124 of /home/XXX/public/XXX/public/profiles/commerce_kickstart/modules/contrib/entity/includes/entity.wrapper.inc).
Severity error

bojanz’s picture

Title: EntityMetadataWrapperException » Create fields on hook_flush_caches().
Category: bug » task
Priority: Critical » Major

I can't reproduce this. Your problem is that you're missing a field on the license entity type (did you create any custom types?) which should never be missing?

We should move the field creation code from hook_enable() to hook_flush_caches(), so that the missing fields are created on each cache clear, fixing the problem for edge cases like yours.

Can you try adding this to your commerce_file.module:

function commerce_file_flush_caches() {
  // Add the default license fields.
  commerce_file_license_configure_types();

  // Add line item fields for all line item types
  commerce_file_configure_line_item_fields();
}

And clearing cache?

bojanz’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Status: Active » Fixed
Issue tags: +possible-backport

This was done in 7.x-2.x (see https://drupal.org/node/1395488#comment-7658191)

Tagging for possible backport.

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