Use the direct method to get the bundle EntityDrupalWrapper::getBundle() instead of through the magic EntityStructureWrapper::__get() since type property is protected in other wrapper cases and throws of the IDE.

I tested and both yield the same results:

$registration = 11;
$registration_wrapper = entity_metadata_wrapper('registration', $registration);
$type_protected = $registration_wrapper->type->value();
$bundle = $registration_wrapper->getBundle();

drush_print($type_protected);
drush_print($bundle);

// 'extended'
// 'extended'
CommentFileSizeAuthor
#3 3016531-4.patch1.86 KBjoelpittet
#2 3016531-2.patch524 bytesjoelpittet

Comments

joelpittet created an issue. See original summary.

joelpittet’s picture

Status: Active » Needs review
StatusFileSize
new524 bytes

Here's a patch for the replacements

joelpittet’s picture

StatusFileSize
new1.86 KB

Whoops, that was status not diff. This is a real patch.

chris matthews’s picture

Status: Needs review » Reviewed & tested by the community

The patch in #3 applied cleanly to registration.forms.inc; registration.entity.inc; and registration.module on 7.x-1.x-dev and after testing they both yielded the same results for me as well so changing the status to RTBC.

  • gcb committed 8a02b31 on 7.x-2.x authored by joelpittet
    Issue #3016531 by joelpittet, Chris Matthews: Use getBundle() from...

  • gcb committed 27d41cc on 7.x-1.x authored by joelpittet
    Issue #3016531 by joelpittet, Chris Matthews: Use getBundle() from...
joelpittet’s picture

Status: Reviewed & tested by the community » Fixed

Looks like this was committed, changing status to fixed. Thanks for the review @Chris Matthews!

Status: Fixed » Closed (fixed)

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