When pushing a node from staging to live server via deploy module, I get an error on the live server:

EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7634 of /opt/drupal/includes/common.inc).

It looks like this was caused by workbench_moderation_store(), which is triggered by _drupal_shutdown_function() (not sure, if it should be triggered in a deploy context). At line 1572 of workbench_moderation_store(), node_save($live_revision) is called, with the following argument for $live_revision:

   Array
        (
            [status] => 1
            [revision] => 0
            [workbench_moderation] => Array
                (
                    [updating_live_revision] => 1
                )

        )

which for sure is no node (though the node has been filled into workbench_node_store) and lacks not only a bundle property.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jneubert’s picture

FileSize
522 bytes

Just a quick workarround

wbobeirne’s picture

Title: Missing bundle property on entity of type node while deploying moderated content » EntityMalformedException on "Set moderation state" action
Status: Active » Needs review
FileSize
493 bytes

The bigger issue (In my case, which is using Views Bulk Operations set moderation action) is that 'behavior' => array('changes_property') is set in the action info definition. What this does is call an entity_save before the drupal_shutdown_function is run. This is during a state where it thinks it's got $node->workbench_moderation['published'] set, but it's actually been unset. This causes workbench_moderation_node_live_load in workbench_moderation_store to return nothing, because there's no live node to load.

Attached is a patch that removes that behavior from the action.

jojonaloha’s picture

Version: 7.x-1.3 » 7.x-1.x-dev
Issue summary: View changes
FileSize
1.63 KB

Attached is a patch that takes into account that workbench_moderation_node_live_load() may return nothing if there is no published version. Also, node_load() may actually return FALSE in rare cases. In that case, we shouldn't try to save the node.

I haven't tested the patch in #2, but it may be that the patch in #2 should be applied as well, but this patch should resolve the EntityMalformedException in all cases, not just with VBO.

jamsilver’s picture

Status: Needs review » Reviewed & tested by the community

Yep, just bumped into this issue too while Using Deploy & Features to export Entities.

Poindexterous’s picture

I'm having this issue pop up with bulk operations using rules components. As bulk operations "publish" and "unpublish" don't sync up with workbench moderation I tried making some rules components to pub/unpub and sync the workbench moderation state. I'm having an unanticipated problem with publishing from an unpublished workbench state through this method. Not only do I get the entity malformed error, but the node seems to go through two workbench transitions (unpub-state --> pub, then pub-->draft) instead of one (unpub-state -->pub). It seems as though the node is saved twice with the entity malformed error in between them. I'm a bit new to drupal development so I'm still trying to figure out how to solve this. I was also looking at issue #1147646 Hard coded 'Draft' status in .module, since the node is saved as "draft" instead of "published". I'm wondering if it's not just the entity bundle info that's missing when this error occurs, but perhaps the workflow status is null as well, causing workbench to insert the default state.

Poindexterous’s picture

Thanks! Patch #3 got rid of my entity malformed error from using bulk operations rules components to change the moderation state. The double-save with the incorrect moderation state is still there, but it's likely a completely different issue.

  • colan committed 614b299 on 7.x-1.x authored by jojonaloha
    Issue #1919706 by jneubert, wbobeirne, jojonaloha: Prevent...
colan’s picture

Status: Reviewed & tested by the community » Fixed
colan’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Status: Fixed » Active

Forgot to set this up for forward porting.

das-peter’s picture

Status: Active » Fixed

Does not apply to the 2.x branch, it uses State Machine / State Flow for those operations.

Status: Fixed » Closed (fixed)

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