Commit b349cc41 authored by amitaibu's avatar amitaibu

Issue #2231217 by Amitaibu: Prevent loading entity in \OgMembership::save() upon og_group().

parent bede7c00
......@@ -23,8 +23,8 @@ class OgMembership extends Entity {
throw new OgException('OG membership can not be created for anonymous user.');
}
$wrapper = entity_metadata_wrapper($entity_type, $etid);
$bundle = $wrapper->getBundle();
$entity = !empty($this->entity) ? $this->entity : entity_load_single($entity_type, $etid);
list(,, $bundle) = entity_extract_ids($entity_type, $entity);
$group_type = $this->group_type;
$gid = $this->gid;
......
......@@ -2017,6 +2017,9 @@ function og_group($group_type, $gid, $values = array(), $save_created = TRUE) {
}
if (empty($og_membership->is_new) || $save_created) {
// Pass the entity object along to OgMembership::save() so we don't have
// to reload it.
$og_membership->entity = $entity;
// Save the membership for update, or if the OG membership is new when
// "save-created" is TRUE.
$og_membership->save();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment