Getting this notice at the end of creating a new variant

Notice: Undefined property: Entity::$type in Entity->bundle() (line 255 of /entity/includes/entity.inc).
CommentFileSizeAuthor
#9 eck_pm-2557609-9.patch780 bytesmarkus_petrux

Comments

joelpittet created an issue. See original summary.

mnico’s picture

Hi joelpittet, I tried to reproduce the issue but I couldn't. Please can you tell me step by step what you did?

Thanks

joelpittet’s picture

Using latest dev of eck & panels & ctools on a production site with many patches. Sorry for the driveby issue I just wanted to bookmark the error I saw while trying out the module.

I'll do this on a fresh (unpatched) site to see if it's reproducible. Of course you must have notices turned on to see these in your environment, but I'm sure you've got that box checked.

joelpittet’s picture

Status: Active » Closed (works as designed)

Can't reproduce the error with or without my patches in clean Drupal install.

Drupal 7.38, eck 7.x-2.x-dev, eck_pm 7.x-1.0-beta3+2-dev

Enable eck_example

drush -y dl --dev ctools panels eck_pm ctools
drush --select dl eck 
drush -y en eck_example eck_pm page_manager panels

Add a employee bundle with the name property enabled.

Go to Page Manager and enable eck_pm_entity_view-eck_employee_view and edit and get all the way to the end.

joelpittet’s picture

Seems one of my entities on my product site is missing a bundle or something.

It is being picked up in eck_pm_properties_form_content_type_content_types() on line 40. when it calls eck_property_behavior_invoke_plugin().

joelpittet’s picture

Update: its only on my one ECK entity that I have entity translation language property enabled(which I don't need). But FYI incase someone else mentions this. It's likely an ECK + entity translation problem.

joelpittet’s picture

Yup confirmed if I remove the 'Entity language' property the notice magically goes away, and it doesn't even have to be on the ECK entity you are panelizing, I had that property on a 'Section' entity type and was panelizing a 'Product recommendation' entity type.

This makes me think that function is asking for more than it's fair share of entity type info.

markus_petrux’s picture

Status: Closed (works as designed) » Active

Please, let me re-open the issue because it happened to us as well, and I think I found the cause. I'll post a patch asap, but the notice origin, in our case, is located in file eck_pm/plugins/content_types/properties_form.inc, function eck_pm_properties_form_content_type_content_types() when it invoked entity_create() with no information about the bundle.

Since I'm not sure where to get the bundle in this point, and a simple fix works for us... here's a code change that avoids the notice.

-    $entity_create = entity_create($entity_type, array());
+    $entity_create = entity_create($entity_type, array('type' => ''));
markus_petrux’s picture

Status: Active » Needs review
StatusFileSize
new780 bytes

The patch.

  • mnico committed 03dcdae on 7.x-1.x authored by markus_petrux
    Issue #2557609 by markus_petrux: Undefined property: Entity::$type in...
mnico’s picture

Well done, i tested this patch with "entity translation" and works very well

thanks

mnico’s picture

Status: Needs review » Reviewed & tested by the community
mnico’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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