Updated: Comment #4
Problem/Motivation
When importing a set of nodes that contain organic group dependencies, I'm getting the following error:
EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7693 of includes/common.inc).
I have previously applied the patch in #1896384: Entity references and taxonomy terms break when importing nodes so that node dependencies would match up as expected, and I think it may have either caused or brought to light this error.
During node save, organic groups is trying resolve the group in og_group_refs, but that still references the old node id which may or may not be correct anymore. There is a dependency in the node object which does properly reference the OG node. If I simply unset og_group_refs before saving the node on import, and then let node_export_dependency do it's thing, it works as expected.
Proposed resolution
I'm attaching a patch based on the 7.x-3.x branch, but it conflicts with the patch in #1896384: Entity references and taxonomy terms break when importing nodes which is probably a prerequisite.
Remaining tasks
Fix conflicts with #1896384: Entity references and taxonomy terms break when importing nodes.
(Recreate the patch using the result of #1896384: Entity references and taxonomy terms break when importing nodes
Review & test.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | 2140075-5.node_export.og_error.patch | 2.07 KB | jrb |
| #3 | 2140075-3.node_export.og_error.patch | 3.69 KB | jrb |
| og_dependency_error.patch | 1.58 KB | mediabounds |
Comments
Comment #1
jrbI'm seeing the same issues that you are in importing OG nodes. I'm not following how the proposed solution in your patch works with the patch in #1896384: Entity references and taxonomy terms break when importing nodes, though.
Could you please post a patch that combines yours with the one in #1896384 so that I can see what the final result is supposed to be?
Comment #2
areke commentedComment #3
jrbOriginally, I tried creating a patch that combined the one above and the one in #1896384: Entity references and taxonomy terms break when importing nodes. When I tried to run an import, though, I got the original "Missing bundle property on entity of type node" error. Because of this, I assumed that I hadn't created the combined patch correctly. That led to my question above. But, the actual problem was that I had an OG Group Reference field on some content types that wasn't named "og_group_ref". So, the combined patch was working correctly, but only with the default field name.
I've created a patch that combines the one from #1896384 with the one above and works with any OG Group Reference field. I had to write a little code to figure out which fields were OG Group Reference fields so it would know which fields to unset(). If there's a better/easier way to do that, let me know.
Also, if it would be better to write a patch that works from the result of #1896384 (rather than combining), I can do that instead.
Comment #4
areke commentedUse summary template
Comment #5
jrbNew patch attached using the result of #1896384: Entity references and taxonomy terms break when importing nodes.
Comment #6
jadhavdevendra commentedI managed to get rid of this error with replacing "target_id" from node export code to the one from destination system.
Lets say "A" is the node id of group from source Drupal. In node export code you will have
Find the node id of same group in destination Drupal. Say "B". Update your node export code to below.
This fixed the error for me.
Comment #7
suydam commentedI'm getting this same error trying to import a node that has User Reference and File fields.
I'm not understanding how i can fix this... the uid to which I'm trying to refer actually exists no problem in the target system, so it's not a failed linkage as far as I can see.
Did anyone ever patch this thing to solve that problem?
Comment #8
danielb commentedReopen if this is an issue with the latest code.