Error message

Deprecated function: implode(): Passing glue string after array is deprecated. Swap the parameters in drupal_get_feeds() (line 394 of /home1/tylerfra/public_html/includes/common.inc).

Drupal - Missing bundle property on entity of type comment

Category: 
Tags: 

After 24 hours of fudging around, I finally figured out what causes this problem. To make a long story short, I needed to make sure the node_type property was set on my comment entity. For example, a comment for an article node needs this property set:

$entity->node_type = 'comment_node_article';

The error message itself is a little misleading, since it says the bundle property is missing. But in actuality, it was looking for the node_type property to be set also.

Background

I am using the Comment Index Resource from the Services module. During hook_services_request_postprocess_alter() I am attaching comment fields to each result, since they don't come packaged with comment index results by default. To do this, I was using the field_attach_load() function, which requires entity(ies) be passed to it. I was setting the bundle property on the comment entities, since I am so used to having to set that property. But apparently the node_type property is really what needed to be set for comment entities.

Strange indeed. Gotta love those one liners, just like the ladies.

Comments

happens, because your bundle property is malformed either on load or save, so Drupal can't find what type of bundle is it.