(Version is actually 7.x-1.x-beta6+13-dev, not the latest 7.x-1.x-beta6+21-dev [which doesn’t yet support the Multiple Parent Groups functionality that this is a Child Issue of], but the “Version *” dropdown doesn’t let me specify specific -dev versions. The latest such patch by rositis@gmail.com in #68 of the Parent Issue has been applied.)
I’m trying to set up a Views VBO to execute a Rules Component with an “Add item to list” Rules Action as its sole action set up to assign a Node (given NID as parameter) to a Group (given GID as parameter) for the purpose of bulk-assigning selected Nodes to a Parent Group (adding to the list of Parent Groups the node[s] may already have rather than overwriting them and thus removing all prior Parent Groups and replacing them with the single specified Parent Group).
When I execute the action either via VBO or when testing in the Rules interface, it works fine if the node(s) specified is/are already gnode(s), as in have one or more Parent Group(s) already assigned.
However, if the node(s) specified are not already gnodes (have no Parent Group[s] assigned), then it generates this AJAX error when I tell it to confirm doing the VBO action:
❌ An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: /batch?id=150&op=do StatusText: Service unavailable (with message) ResponseText: Recoverable fatal error: Argument 2 passed to EntityMetadataWrapperIterator::__construct() must be of the type array, null given, called in …/sites/all/modules/entity/includes/entity.wrapper.inc on line 1119 and defined in EntityMetadataWrapperIterator->__construct() (line 1197 of …/sites/all/modules/entity/includes/entity.wrapper.inc).
The error seems to happen in the Entity API module (and I’m going to bring this up over there, too), and may be something within Rules. But I suspect it has to do with the presence or absence of the $node->group
value.
Comments
Comment #2
Joel MMCC CreditAttribution: Joel MMCC commentedSolved. This was caused by a bug in the latest stable release (7.x-1.8) of Entity API: #2090007: EntityDrupalWrapper::getIterator() throws PHP error: EntityMetadataWrapperIterator::__construct() must be an array.
A patch was provided and has since been rerolled into the latest 7.x-1.8+4-dev, so just make sure that you’ve installed a version of Entity API released on or after March 8, 2017. For now, that’s 7.x-1.x-dev released on that date (shows up as 7.x-1.8+4-dev once installed). You can safely upgrade 7.x-1.8 in place without having to disable and re-enable — simply download and overwrite the existing 7.x-1.8.
With this in mind, Bulk Assigns of Nodes to a Group is now possible even with #2317195: Allow more than one parent by node / subgroup applied and activated, by using a VBO View with Rules. Just Import this Component under Rules and set it as an available VBO Action:
Comment #4
maxplus CreditAttribution: maxplus commentedThanks,
patch from https://www.drupal.org/node/2090007#comment-7865853 also solved this error for my using the multi parent group patch in combination with a rules action "add item to list"
Comment #5
Joel MMCC CreditAttribution: Joel MMCC commentedI’ve verified that Entity API stable version 1.9 or later does incorporate the necessary patch, so no need to use the -dev version anymore.