I use entity_dependency with uuid module in order to export nodes to features.
When node with translation is added in install stage and on features list page entity_dependency produces critical error:

EntityMalformedException: Missing bundle property on entity of type node

Comments

Sergii’s picture

I believe you should check $entity variable before passing to entity_extract_ids().

Sergii’s picture

Status: Active » Needs review
danielb’s picture

Status: Needs review » Reviewed & tested by the community

While mucking around with this module I also encountered this exception, (due to a bug I caused) where it was trying to load an entity that didn't exist.
Sergii's patch did the trick to avoid the exception and skip the failed entity.

ianthomas_uk’s picture

Status: Reviewed & tested by the community » Needs work

Surely the problem here is that entity_load() isn't returning the entity? Yes, this patch will stop the fatal error, but the entity won't be deployed, which could be even worse.

Ideally we should fix the entity_load() call, but at the very least it should log that an entity failed.

ianthomas_uk’s picture

Status: Needs work » Needs review
StatusFileSize
new1.54 KB

Coincidentally after adding my last comment I ran into the bug myself and have produced this alternative patch. I realised that entity_load wasn't returning an entity because my parent node was corrupt, which isn't really something we can do much about.

Instead of ignoring the missing entity when trying to use it, I stop the entity from even being added to the iterator in the first place, and log a watchdog_warning. This means it fixes the problem in both EntityDependencyIterator::hasChildren(), like the patch on #1, and DeployIterator::current() from the deploy module.

It would be great to get this in and release a new alpha of entity_dependency, as currently the deploy module only works with 7.x-1.x-dev.

jakeschlachter’s picture

Issue summary: View changes

Found this thread after running into the same error, attempting to use Deploy and Features to set up taxonomy terms. Thank you for the patch. It worked for me.

dixon_’s picture

Status: Needs review » Needs work

This patch needs re-rolling after commit 4139d7cb34304e7d1515b5dc1d4a0ab5fe15808d went in.

  • dixon_ committed ac41e43 on 7.x-1.x
    Issue #1538848 by ianthomas_uk, Sergii: Fixed EntityMalformedException:...
dixon_’s picture

Status: Needs work » Fixed

Committed the re-rolled patch to 7.x-2.x! Thanks a lot @ianthomas_uk and @Sergii for working on this!

Status: Fixed » Closed (fixed)

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