EntityMetadataWrapperException: Unknown data property field_target_comments. in EntityStructureWrapper->getPropertyInfo() (line 339 of commons-7.x-3.0-beta1/profiles/commons/modules/contrib/entity/includes/entity.wrapper.inc).

I create an event
I do not associate it with any group
I click save/submit it works
I add a comment
I get a wsod and the message above

CommentFileSizeAuthor
#18 comment_node_nogroup-1868776.patch8.01 KBmmilano

Comments

jpontani’s picture

I'm guessing this has to do with Commons Activity Streams message type, somehow the message entity does not have the proper field instance associated to it.

/**
 * Implements hook_comment_insert().
 */
function commons_activity_streams_comment_insert($comment) {
  $account = user_load($comment->uid);
  $node = node_load($comment->nid);

  $message = message_create('commons_activity_streams_comment_created', array('uid' => $account->uid, 'timestamp' => $comment->created));
  // Save reference to the node in the node reference field, and the
  // "publish" state (i.e. if the node is published or unpublished).
  $wrapper = entity_metadata_wrapper('message', $message);
  $wrapper->field_target_nodes[] = $node;
  $wrapper->field_target_comments[] = $comment;

  // The message should be published only if the node and the comment are
  // both published.
  // @todo: Deal with message publishing/unpublishing.
  /*
  $published = $node->status && $comment->status;
  $wrapper->field_published->set($published);
  */
  $wrapper->save();
}
ezra-g’s picture

Title: Adding a comment to an event gives me a WSOD error » Target comments field missing from
Component: Events » Activity/status streams
Priority: Normal » Major
Status: Active » Closed (cannot reproduce)

I'm unable to reproduce this with the latest dev version of Commons. Please re-open if you're able to do so.

ezra-g’s picture

Title: Target comments field missing from » Target comments field missing from 'comment created' message
jlea9378’s picture

Status: Closed (cannot reproduce) » Active

EntityMetadataWrapperException: Unknown data property field_target_nodes. in EntityStructureWrapper->getPropertyInfo() (line 339 of /home/clients/websites/w_comm7/public_html/comm7/profiles/commons/modules/contrib/entity/includes/entity.wrapper.inc).

I'm still getting this error. I tried upgrading my site from Beta1 (the stable release) to the latest Dev release (commons-7.x-3.0-beta1+12-dev), but it didn't fix the issue. I ran update.php (there were no db updates to execute) and I reverted all of the enabled features that showed "overridden".

Topcheese’s picture

Just a heads up the latest is 7.x-3.0-beta1+14-dev posted today. I do believe there were still some issues with the release that you're using. I think they fixed the problem in today's release.

jpontani’s picture

I'm still getting this error. I tried upgrading my site from Beta1 (the stable release) to the latest Dev release (commons-7.x-3.0-beta1+12-dev), but it didn't fix the issue. I ran update.php (there were no db updates to execute) and I reverted all of the enabled features that showed "overridden".

You'll have to do a feature revert on the Commons Activity Stream feature after update as it might have contained changes to the feature export that just a simple upgrade won't take into account.

ezra-g’s picture

#6 is correct.

Also note that until recently, the Commons nightly dev snapshot hadn't updated since Dec 27, 2012. This was fixed by #1882498: Switch from git checkouts to nightly dev snapshots, so the dev snapshot is now significantly more up-to-date.

jlea9378’s picture

I did revert all of the enabled features:
"I reverted all of the enabled features that showed "overridden"."

Topcheese’s picture

Just a couple of thing here. I see this issue with the the latest 7.x-3.0-beta1+14-dev updated from the previous version. Is it just me or is the description field broken, I don't see the WYSIWYG field with admin, or user acccount. The WYSIWYG is working for the comment field, so I wonder if that could be a source of the problem. It looks like it's trying to get a property from the broken piece.

jpontani’s picture

Updating a feature won't necessarily fix the underlying issue. Some parts of a feature are only read once on install and then stored in the database. In this case, an uninstall of the existing (old) feature, updating to the latest code, and then reinstalling should remedy the field_target_comments error.

jlea9378’s picture

I couldn't get uninstalling the old feature, updating to latest code, and reinstalling to solve the problem. Looks like the only way to solve things is to do a clean install...

jlea9378’s picture

I just did a clean install of the latest dev release (Jan 10th) and I am still getting this when commenting on a Post:

EntityMetadataWrapperException: Unknown data property field_target_comments. in EntityStructureWrapper->getPropertyInfo() (line 339 of /home/clients/websites/w_comm7/public_html/comm7/profiles/commons/modules/contrib/entity/includes/entity.wrapper.inc).

jpontani’s picture

Status: Active » Postponed (maintainer needs more info)

I'm unable to reproduce this with a fresh install.

I just did a drush make on the Commons makefile from git and don't get any errors when commenting on a Post.

Topcheese’s picture

Status: Postponed (maintainer needs more info) » Active

I suspect that the issue still exist and needs to be chased down. I did not have to revert Commons Activity Stream when I updated Commons to the latest(Jan 10). @jpontani, when you say "post," you mean "Event" I hope. I think my exact steps were this. After enabling the navigation menu so that a regular user can post an event. I log in as the regular user and post an event from the menu and not the group section. I then logged out and back in as admin and got the error when trying to comment on the event.

I'm not sure of my exact specs atm, but it's on a Lamp setup.

jpontani’s picture

I was following from #12 saying commenting on a post. I will try some more troubleshooting later. If the event is not associated to the group it might be causing a different error with the message since the comments message has a group reference token that would then not be valid. I'm not sure if this would break it but it might be causing other issues.

jlea9378’s picture

Any update on this issue yet? I see there is a newer dev release. Would this issue be fixed in the latest release?

jpontani’s picture

This is not just limited to Events, it happens when commenting on any node (not just Events) that are not associated to a group. Something on the message entity itself isn't allowing an entity metadata wrapper to be properly formed if the node has no values for OG group ids.

mmilano’s picture

Status: Active » Needs review
StatusFileSize
new8.01 KB

I was able to reproduce this as described in the original post. As admin, I created an event with no group associated to it, then posted a comment.

When there is no group associated with the node, it assigns the 'commons_notify_node_created_no_groups' message type.

if (!isset($node->og_group_ref[LANGUAGE_NONE][0]['target_id'])) {
  $message_type = 'commons_notify_node_created_no_groups';
}

This message type was missing the field: field_target_comments

Attached is a patch of the resulting feature export.

jpontani’s picture

Status: Needs review » Reviewed & tested by the community

#18 looks good. Just tested on Events and Posts, neither in a group, and the comment posts and there is an activity stream message.

jlea9378’s picture

Yes, this patch seems to have fixed the problem. Thanks!

tamerzg’s picture

Confirming that #18 works for me.

bertran2’s picture

Version: » 7.x-3.0-beta2

I had the same error message installing beta2:

Placing a new blog post and trying to comment it:

EntityMetadataWrapperException: Unknown data property field_target_comments. a EntityStructureWrapper->getPropertyInfo() (línia 339 de ....../public_html/profiles/commons/modules/contrib/entity/includes/entity.wrapper.inc).

Comment an event works good.

(This is the first time I report an error, sorry if it doesn't fit here)

jlea9378’s picture

Version: 7.x-3.0-beta2 »
ezra-g’s picture

Status: Reviewed & tested by the community » Needs work

This patch adds Strongarm entires to the .info file without including the .strongarm.inc file, causing the commons_notify feature to be overridden.

ezra-g’s picture

Status: Needs work » Fixed

I re-exported, added the file and committed.

Thanks, mmilano!
http://drupalcode.org/project/commons_notify.git/commit/f21fe58

bertran2’s picture

Thank you, after updating it works good! :)

Status: Fixed » Closed (fixed)

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