Hello,

I am facing given below error while delete the OG.

Call to undefined method EntityValueWrapper::getBundle()

When i disabled the og_vocab module or comment the "og_vocab_entity_delete" function the OG will deleted successfully.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

RoySegall’s picture

Did you mean when you delete a group you get this error?

RoySegall’s picture

We had the same problem in OS yesterday. Do you have the redirect module enable?

kulbhushan’s picture

Hi

I had the same problem facing while deleting the og. Give below is code for solving this issue.

function hook_vocab_entity_info_alter(&$entity_info) {
$entity_info['og_vocab']['uri callback'] = 'hook_og_vocab_uri';
}

function hook_og_vocab_uri($og_vocab) {
$url = array();

$vocab = taxonomy_vocabulary_load($og_vocab->vid);
if (user_access('administer taxonomy') && is_object($vocab)) {
// URL to taxonomy administration.
$url = array(
'path' => "admin/structure/taxonomy/$vocab->machine_name/edit",
);
} else {
$relation = og_vocab_relation_get($og_vocab->vid);
if (is_object($relation)) {
if (og_user_access($relation->group_type, $relation->gid, 'administer taxonomy')) {
// URL to taxonomy administration in the group context.
$url = array(
'path' => "group/$relation->group_type/$relation->gid/admin/taxonomy/$vocab->machine_name/edit",
);
}
}
}
if (count($url)) {
$entity_type = $og_vocab->entity_type;
$bundle = $og_vocab->bundle;
$url['options']['fragment'] = drupal_clean_css_identifier("og-vocab-$entity_type-$bundle");
}
return $url;
}

ulethjay’s picture

I realize this is incredibly old, but in the event someone else runs into this issue...

I too had the redirect module installed, though that is not really the issue.

When deleting a vocabulary og_vocab_entity_delete runs its course leading to og_vocab_relation_get. This function queries the database and stores the result via drupal_static.

Later in the process redirect_entity_delete comes along, makes its way to og_vocab_relation_get, and fails twice to retrieve the same data.

The first failure occurs because drupal_static isn't called by reference, leading $cache to be empty on the second pass.

The second failure I don't fully understand, but despite running the same query as before, db_select produces zero results the second time.

Having said all that, I might be beneficial for og_is_group, etc, to ensure they aren't trying to put an entity wrapper around a NULL.

Fatal Error!?! Meh, worked for me. Just change drupal_static to &drupal_static in og_vocab_relation_get

amitaibu’s picture

Status: Active » Needs review

Nice catch, lets see what testbot thinks of it :)