I exported all my message types, fields, ... as features and imported them.

But somehow the message_type was not created/activated.
Which resulted in this error?

EntityMetadataWrapperException: Unknown data property message_text. in EntityStructureWrapper->getPropertyInfo() (line 339 of /data/www/sas-webstore/www/sites/all/modules/contrib/entity/includes/entity.wrapper.inc).

What can I do?

Can I activate it somehow?

Comments

thim’s picture

Not sure why this happened but I ran

the following code via the /devel/php and then the message_text field was created

<?php
 
// Create the message text field for our message type category.
 
$instance = array(
   
'field_name' => MESSAGE_FIELD_MESSAGE_TEXT,
   
'bundle' => 'commerce_order_message',
   
'entity_type' => 'message_type',
   
'label' => t('Message text'),
   
'description' => t('This is the text of all messages of this type.'),
   
'required' => TRUE,
   
'settings' => array(
     
'text_processing' => 1,
     
// Mark that this field can be rendered using Message::getText().
     
'message_text' => TRUE,
    ),
  );
  if (
$existing_instance = field_info_instance($instance['entity_type'], $instance['field_name'], $instance['bundle'])) {
   
field_update_instance($instance);
  }
  else {
   
field_create_instance($instance);
  }

 
// Add a display name field.
 
$field = array(
   
'field_name' => 'message_order_display_name',
   
'type' => 'text',
   
'module' => 'text',
   
'cardinality' => '1',
   
'translatable' => TRUE,
   
'settings' => array(
     
'max_length' => '255',
     
// Mark that this field can be rendered using Message::getText().
     
'message_text' => TRUE,
    ),
  );
  if (
field_info_field($field['field_name'])) {
   
field_update_field($field);
  }
  else {
   
field_create_field($field);
  }
 
$instance = array(
   
'field_name' => $field['field_name'],
   
'bundle' => 'commerce_order_message',
   
'entity_type' => 'message_type',
   
'label' => t('Display name'),
   
'description' => t('The name of this message type as displayed in logs.'),
   
'required' => TRUE,
   
'settings' => array(
     
'text_processing' => 0,
    ),
  );
  if (
$existing_instance = field_info_instance($instance['entity_type'], $instance['field_name'], $instance['bundle'])) {
   
field_update_instance($instance);
  }
  else {
   
field_create_instance($instance);
  }

 
// Add text format if it doesn't exist.
 
if (!filter_format_load('commerce_order_message')) {
   
$format = (object) array(
     
'format' => 'commerce_order_message',
     
'name' => 'Commerce Order Message',
     
'weight' => 0,
     
'filters' => array(
       
// HTML filter.
       
'filter_html' => array(
         
'weight' => 1,
         
'status' => 1,
        ),
      ),
    );
   
filter_format_save($format);
  }
?>

I'm going to put it in a update_hook and in the install_hook of my module.

vasike’s picture

Version:7.x-1.8» 7.x-1.9

there's a similar issue on Commerce Message issue queue : #2053821: EntityMetadataWrapperException error every time new orders are entered.

rbosscher’s picture

I've had the same error.
Reinstalling the message module resolved the issue.

that0n3guy’s picture

Re-installing seemed to take care of this for me too (I am on v1.7 though).

axel.rutz’s picture

Version:7.x-1.9» 7.x-1.x-dev
Priority:Normal» Major

Setting major as this makes the module unusable.
For me this is fixed by #2108283: Entity language info missing.
Please review so we can get this in.

harings_rob’s picture

Issue summary:View changes

Running #1 solved the error message, but the message description is empty (even when creating a new)

harings_rob’s picture

removing, unsinstalling, installing commerce kickstart orders and commerce message solved this.

maxplus’s picture

Problem also solved for me by just disabling and back enabling the Commerce Message, Message and Message Notify modules

EDIT:

problem is not solved, only when I keep Commerce Message disabled...

gowlj’s picture

same problem here, disabling/enabling modules did not resolve.
error if fired by opening /content/message or orders in quick edit mode.
(the last issue is partially fixed by hiding in commerce/config/order/display the field EVA: Commerce Message: Order messages - Entity content)

alexmcl’s picture

Solution from #7 by easycombvba worked for me

axel.rutz’s picture

Here's a shortdut that helped me:

<?php
module_load_include
('install', 'commerce_message');
commerce_message_install();
?>
andyg8’s picture

I've just encountered the same error after updating to Views 7.x-3.11 and Drupal 7.37 with rc3 and dev. I've disabled all the Message modules and re-enabled to no avail. In dev I don't seem to get the fatal error, just the order's history table is empty.
In rc3 the fatal error seems to occur the first time I try to load an order from within admin. After navigating away from the order and coming back to it no error - just the Order history table is empty.
Any recent thoughts on this issue?