I'm trying to retrieve property information on the "filename" property of (managed) "file" entities:

entity_metadata_wrapper('file')->getPropertyInfo('filename');

... which unfortunately causes the following error message:

EntityMetadataWrapperException: Unknown data property filename. in EntityStructureWrapper->getPropertyInfo() (ligne 339 in ... \entity\includes\entity.wrapper.inc)."

I think I've tracked this down to entity_metadata_system_entity_property_info() which only declares a "name" property but no "filename" property. The reason why I'm using "filename" instead of "name" is because system_entity_info() specifies that the entity "label" for (managed) files is stored in the "filename" property.

CommentFileSizeAuthor
#1 filename-property-fix-1805416-1.patch569 bytesbforchhammer

Comments

bforchhammer’s picture

Status: Active » Needs review
StatusFileSize
new569 bytes

Attached patch changes the property definition in entity_metadata_system_entity_property_info().

Status: Needs review » Needs work

The last submitted patch, filename-property-fix-1805416-1.patch, failed testing.

bforchhammer’s picture

Status: Needs work » Closed (won't fix)

Okay, so tests would need to be updated as well...

I'm closing this issue because the change would likely cause problems in other places relying on the current behavior, and I've found a different solution to my problem in #1802170: Automatic Entity Label for file types doesn't work which avoids using the entity metadata wrapper altogether.