Update: I figured out this error occurs when you delete a node (and maybe other entities too), they aren't deleted from the plan, and deploy try to push them. So the real solution here is to remove the node from the plan when it's deleted, or should it also be deleted on destination sites when pushing?

After pulling latest dev code, I'm getting this error when trying to deploy some nodes:

EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7501 of /Users/henrique/Sites/drupal7/includes/common.inc).

Comments

aspilicious’s picture

Status: Active » Postponed (maintainer needs more info)

What kinda fields were in the content type you tried to push?
I cannot reproduce (yet)

recidive’s picture

Status: Postponed (maintainer needs more info) » Active

Maybe that's caused by media module/field. Can you try and confirm that?

aspilicious’s picture

function field_deploy_entity_alter(&$entity, $entity_type) {
calls
entity_extract_ids($entity_type, $entity);
And that one causes an error, because the bundle property should be part of the entity but isn't.

More info I found:

MIssing bundle property error
Posted by danielb on December 15, 2011 at 4:09am
This is often used after entity_load(). Note that unlike node_load() which returns an object, entity_load() returns an array of objects - even if you only asked for one. Be sure to get the entity out with something like reset() before passing the result to this function or you will get the unhelpful "Missing bundle property" error.

I'm going to try to reproduce this and print the entity/entity_type in watchdog and see what comes out...

But yeah probably related to media module.

recidive’s picture

@aspilicious: I figured out this error occurs when you delete a node (and maybe other entities too), they aren't deleted from the plan, and deploy try to push them. The error is gone after uninstalling and re-installing deploy module.

I'm gonna edit the issue and change title and description to point this out.

recidive’s picture

Title: EntityMalformedException error » Nodes not deleted from plan gives EntityMalformedException error
Priority: Normal » Major
aspilicious’s picture

What if we do the following

Create a deploy_entity_delete($entity, $type) { function that reacts on entity deletion.
When it fires we look up the current plans and call deploy_manager_delete_from_plan($plan_name, $entity_type, $entity); on it.

Ok?

aspilicious’s picture

Status: Active » Needs review
StatusFileSize
new869 bytes

Could you test this?

ps: I'm not sure were to place this function
ps2: if you got a broken databse before appliying the patch, it's probably the best to clear the deploy_manager_entities table in phpmyadmin

dixon_’s picture

Status: Needs review » Needs work
+++ b/deploy.module
@@ -423,3 +423,13 @@ function deploy_log($key, $status, $message = '', $variables = array(), $timesta
+/**
+ * Implements hook_entity_delete().
+ */
+function deploy_entity_delete($entity, $entity_type) {
+  $plans = deploy_plan_load_all();
+  foreach ($plans as $plan) {
+    deploy_manager_delete_from_plan($plan->name, $entity_type, $entity);
+  }
+}

We should use deploy_manager_plan_load_all() here, since this is only relevant to managed plans.

Otherwise everything looks good here.

aspilicious’s picture

Status: Needs work » Needs review
StatusFileSize
new976 bytes

I also moved the function to deploy.manager.inc

recidive’s picture

Status: Needs review » Needs work

Patch no longer apply. Please re-roll and I'll review.

aspilicious’s picture

Status: Needs work » Needs review

recidive are you on latest dev? I have no troubles applying the patch. And I rechecked my local commit and I'm one commit ahead of latest commit, so everything should be fine.

(Rechecked several times :p)

recidive’s picture

Ok, I was on another branch and may have a failed rebase and didn't notice it. I'll try it again now.

recidive’s picture

Status: Needs review » Reviewed & tested by the community

Alright, confirmed the node is being removed from the plan now.

aspilicious’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Issue summary: View changes

Describing the real source of the problem.