The below export can produce the problem. I tried upgrading to -dev of both rules and entity

{ "rules_saving_new_stuff_again" : {
    "LABEL" : "Saving new node",
    "PLUGIN" : "reaction rule",
    "REQUIRES" : [ "rules" ],
    "ON" : [ "node_insert" ],
    "DO" : [
      { "variable_add" : {
          "USING" : { "type" : "list\u003centity\u003e", "value" : [ "" ] },
          "PROVIDE" : { "variable_added" : { "endpoint_list" : "Entity list" } }
        }
      },
      { "entity_fetch" : {
          "USING" : { "type" : "node", "id" : "1" },
          "PROVIDE" : { "entity_fetched" : { "entity_fetched" : "Fetched entity" } }
        }
      },
      { "list_add" : { "list" : [ "endpoint-list" ], "item" : [ "entity-fetched" ] } }
    ]
  }
}

From apache's log:
Fatal error:  Class name must be a valid object or a string in /var/www/drupal-7.2/includes/common.inc on line 7475, referer: http://50.57.86.194/drupal-7.2/?q=node%2Fadd%2Farticle&
$entity_type argument has the value 'entity', instead of a "real" entity type. Tried catching a back trace as well but that required more memory than my 256.

Files: 
CommentFileSizeAuthor
#5 entity_wrapper_entity_2.patch4.49 KBdixon_
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch entity_wrapper_entity_2.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.
[ View ]
#3 entity_wrapper_entity.patch3.66 KBfago
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch entity_wrapper_entity.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.
[ View ]

Comments

The same error. Subscribe.

Project:Rules» Entity API
Version:7.x-2.x-dev» 7.x-1.x-dev
Component:Rules Engine» Entity property wrapper
Issue tags:+Needs tests

uhm, seems to be a general problem of the entity wrappers. They just don't support generic list of entities yet :(
E.g. I was able to reproduce it with

<?php
$w
= entity_metadata_wrapper('list<entity>', array());
$w[0] = entity_metadata_wrapper('node', 1);
debug($w->value());
?>

I think the list-wrappers set() and value() method need to special-case generic lists of entities. Regular lists-of-entities are internally represented as an array of entity ids, which then the list-wrapper entity_loads() on demand in value() and turns objects into ids in set().
For generic entity lists though, a list of ids doesn't suffice as we also need the types too.

A bit confusing, but the entity-wrapper use another entity-wrapper-instance to hold the "value" of a generic entity reference. Thus it expects you to pass a wrapped entity as value, what I think rules should be correctly doing.
The problem is, that the list-wrapper now handles the generic-entity-reference like a special one, i.e. it tries to run an entity_load() in value().
Instead, just returning/setting the values as is (=entity wrappers) in value() and set() should be fine and solve the problem.

We also need to cover that in the tests then.

StatusFileSize
new3.66 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch entity_wrapper_entity.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.
[ View ]

I had a look at it and fixed some issue with generic entity handling.
Attached patch makes the above code example work for me (just replace debug() with dpm()), but misses tests.

Awesome! I tried it out with Rules, and the rule now executes correctly. Since this is tagged needs tests I'm leaving it open.

Status:Active» Needs review
StatusFileSize
new4.49 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch entity_wrapper_entity_2.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.
[ View ]

As mentioned, very simple to test. Here is a patch based on #3, plus the tests. Everything passes for me.

Status:Needs review» Fixed

thanks, committed.

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