How to access all of the properties related to Commerce Line Item entity in a rule? I wonder how I can access all of the line item properties in Rules?

For example in a Rules event "Before saving a line item" I can show a debug message of the line item.
It has different properties such as commerce_display_path and data->context->entity which however aren't available in Rules ie. I cannot set them as variable for later processing.

How could I make these properties available to Rules? I've tried to add different conditions to make sure the "whole entity" is loaded to Rules but still I cannot access these properties.

EDIT 1

I've now tried to develop a solution to provide this data to Rules.
Following enables only entity(field collection item) id and entity revision and nothing else. I thought that it would provide the whole entity and it's properties (or at least so I understood from documentation that all that entity__property_info returns).

EDIT 2

Now I can set a message on site that presents host entity properties. However, I cannot use those properties in any other rules functionality eg. I cannot create variable from field regarding field collection item i.e. I still cannot make use of them. Why the properties are available for message but not for anything else?

function mymodule_entity_property_info_alter(&amp;$info)
{
  if (isset($info['commerce_line_item'])) {
    $info['commerce_line_item']['properties']['host_entity'] = array(
      'label' =&gt; 'Host entity',
      'type' =&gt; 'field_collection_item',
      'description' =&gt; t('Host entity of a line item.'),
      'getter callback' =&gt; 'mymodule_get_host_entity_callback',
      'setter callback' =&gt; 'entity_property_verbatim_set',
      'computed' =&gt; true,

    );


 $bundles['field_collection_item'] = array('label'=&gt;'Field collection item', 'properties'=&gt;entity_get_all_property_info('field_collection_item'));
    dpm($info['commerce_line_item'], 'line item in entity info alter');
  }
}

function mymodule_get_host_entity_callback($entity, array $options, $name, $entity_type)
{
  dpm($entity, 'line item entity in Rules callback');
  $wrapper = entity_metadata_wrapper($entity_type, $entity);

  $host_entity_id = $wrapper-&gt;data-&gt;context-&gt;entity-&gt;entity_id-&gt;value();
  $host_entity_type = $wrapper-&gt;data-&gt;context-&gt;entity-&gt;entity_type-&gt;value();

  $host_wrapper = entity_metadata_wrapper($host_entity_type, $host_entity_id);
  $host = $host_wrapper-&gt;value();

  return $host;
}

function mymodule_set_host_entity_callback($entity, array $options, $name, $entity_type)
{
  $wrapper = entity_metadata_wrapper($entity_type, $entity);

  return $wrapper-&gt;host_entity-&gt;value();
}
Below is a possible approach you can use to solve your question. It provides the details about how I was able to have a set of Drupal messages being shown at checkout time, which look similar to this testcase I used (for a cart with 3 line items):

Current line item has label 'USB-BLU-08' and id '17'
Current line item has label 'TSH4-BLK-MD' and id '18'
Current line item has label 'MES1-BLU-OS' and id '19'


To get this to work, I created a custom rule, which looks like so (use the Rules UI to import it in your own site):

{ "rules_access_line_items_at_checkout" : {
    "LABEL" : "Access line items at checkout",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "commerce_checkout" ],
    "ON" : { "commerce_checkout_complete" : [] },
    "DO" : [
      { "LOOP" : {
          "USING" : { "list" : [ "commerce-order:commerce-line-items" ] },
          "ITEM" : { "line_item" : "Current line item" },
          "DO" : [
            { "drupal_message" : { "message" : "Current line item has label \u0027[line-item:line-item-label]\u0027 and id \u0027[line-item:line-item-id]\u0027" } }
          ]
        }
      }
    ]
  }
}


Some details about it:


Rules Event: After completing the checkout process.
Rules Condition: none.
Rules Action: Create a loop, to iterate over each line item. And for each line item, show a Drupal message, starting with "Current line item has ...". Obviously, at this point you could display any of the properties related to a line item.


Easy, no?

PS: I'm assuming this question is about D7 ...