Hi guys,

I think you can help with this issue. I have the following code:

$node_wrapper = entity_metadata_wrapper('node', $node);
$locations = $node_wrapper->field_locations->value();

Normally you can access in this way to your properties. This is very useful when you install the locale module and you don't wanna fight against the language properties in your custom fields. The main problem is when I get this error:

EntityMetadataWrapperException: Unknown data property field_locations. in EntityStructureWrapper->getPropertyInfo() (line 339 of /home/tanga0/public_html/apps/quecomida/sites/all/modules/entity/includes/entity.wrapper.inc).

So I think this issue is related to this one:

http://drupal.org/node/1366642

Any idea? Thanks!

Comments

tce’s picture

I've just come across this error. Also using Ctools entity_metadata_wrapper() and trying to view and save a Geolocation field.

@tangamampilia, does the patch work http://drupal.org/files/geolocation.module.patch?

Update: patch works fine for me

tangamampilia’s picture

Let me check later... thanks tce!

Ananya MultiTech’s picture

hi...

just a small suggestion : I have observed that value() is supported only in case of simple properties like integer, text etc.. But if u have Taxonomy or Node Reference or User Entity Reference field then you can use raw() if u want to compare IDs or use label() if u want readable code..

I used it like this :

$thenode = entity_metadata_wrapper('user', 3);
if ( $thenode->field_rank->label() == 'Active Distributor') 
    {/*lights camera action..*/}

**Lot of useful functions available in entity.wrapper.inc

alex.bukach’s picture

Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new2.53 KB

The patch worked fine for me too. Why not to commit it?

alex.bukach’s picture

StatusFileSize
new3.58 KB

Property types and latitude/longitude property are added.

derjochenmeyer’s picture

StatusFileSize
new3.35 KB

Last patch had local dir structure in it. Please use / test updated patch. If this works, lets commit it to dev.

alex.bukach’s picture

Oh, right, derjochenmeyer. Thanks for fixing it!

derjochenmeyer’s picture

derjochenmeyer’s picture

Dont know if this got fixed with another commit or if its still relevant.

derjochenmeyer’s picture

Version: 7.x-1.0-beta2 » 7.x-1.x-dev
derjochenmeyer’s picture

Status: Needs review » Fixed

Seems to be fixed.

Status: Fixed » Closed (fixed)

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

mykola dolynskyi’s picture

Hi. I got this trying to wrap the entity of type node
EntityMetadataWrapperException: Unknown data property field_usr. in EntityStructureWrapper->getPropertyInfo() (line 335 of /var/www/extranet/sites/all/modules/entity/includes/entity.wrapper.inc).

field_usr -- is field of type entityreference
node bundle i am trying to wrap has no this field
version of module 1.7

alex.bukach’s picture

@Mykola Dolynskyi why do you think it's related to Geolocation Field module?

mykola dolynskyi’s picture

@Alex Bukach same errorm same line of code
it is related to entity_metadata_wrapper itself

alex.bukach’s picture

@Mykola Dolynskyi in the reported case the field was geolocation field, and therefore the issue was related to this module. You say in your case it's entityreference field, so it sounds to be completely not related to geolocation field module.