Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Offshot of http://drupal.org/node/832046#new:
- EntityStructureWrapper::getPropertyInfo() replaces _ with -: "$name = str_replace('_', '-', $name);". Why is it doing that? Because I have a property named "thread_id", and if I define it like that, it throws an exception and if I define it as "thread-id", then it works fine but obviously isn't going to find the related data. Do I need to define a getter callback?
Comments
Comment #1
fagoHm, that should work just with 'thread_id'. Internally the property will be re-named to thread-id, but the default getter should work with that. What was the exception you got?
I don't think this internal rename thing was a good idea, perhaps we should just go and change the API and remove it.
Comment #2
BerdirThis is the exception:
This is the configuration of thread_id that doesn't work:
This works:
Comment #3
BerdirOk, I got it. I have to specifiy 'entity_metadata_verbatim_get' as the getter callback and then it works :)
I guess that should be documented somewhere and then this issue can be closed...
Comment #4
fagook, I changed it to always use underscores -> API change!
I think that makes it much clearer to use, but any modules exposing the property names to end users (like Rules) have to replace the underscore by dashes themselves in order to get prettier names.
Comment #5
BerdirUhm. Something is not working correctly here.
I think this totally broke integration for privatemsg.module, because our entity is called "privatemsg_message". That is now displayed as "privatemsg-message" but doesn't seem to be translated back to "privatemsg_message" so it fails to access it (and any property below it).
It always fails with the following (or similiar) rules debug message "13.991 ms Unable to get variable privatemsg-message:author, it is not defined." and we're positive that this worked at some point :)
Comment #6
BenK CreditAttribution: BenK commentedSince I'm working with Berdir on Private Message Rules integration, tracking this thread...
Comment #7
fagoouch, thanks. let's handle that in #919112: variable names with underscores are broken
Comment #8
BenK CreditAttribution: BenK commentedI can confirm that the "privatemsg-message:author" issue is now fixed after fago's commit on the #919112 thread referenced in #7. :-)
We're still having an issue with "privatemsg_message:thread-id", but I need to check with Berdir if that one is still using the old dash format. We're currently getting the following error message:
10.518 ms Unable to apply data selector privatemsg_message:thread-id: Unknown data property thread_id.
--Ben