Steps to repeat:
1. Install the relation, relation_ui, rules and rules_ui modules.
2. Create a Relation 'has page' from User to the Basic Page content type.
3. Go to admin/config/workflow/rules/components/add
4. Add a Rule with one parameter 'relation' of type 'Relation'
5. Add a Condition: Entity relation is of Bundle 'has page'
6. Add a Condition 'Data Comparison'. Select relation:endpoints:1:
Expected Results:
Rules should know that endpoint 1 of the Relation is a basic page, so I should be able to select the body field.
Actual Results:
There is nothing to select after relation:endpoints:1:
If I install the entityreference module and add an entityreference field referring to basic pages to the relation, that works fine - I can do a data comparison for relation:field-page-reference:body:value to my Rules.
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | relation_type_specific-1855418-14.patch | 2.66 KB | djdevin |
| #7 | relation-1855418-7-type-specific-properties.patch | 2.87 KB | milesw |
| #4 | screenshot.png | 50 KB | Paul B |
| #1 | 1855418-relation-relation_type_properties_missing-1.patch | 1.39 KB | tauno |
Comments
Comment #1
tauno commentedThe property needs to be added to the array of properties for the relation type, not the bundles that are allowed in the endpoint.
Comment #2
mikran commentedWell, that's a change but a little more description for reviewers is needed, why is it wrong originally & what kind of problems is it causing?
Comment #3
naught101 commentedSorry, but this is mindless. The two variables contain exactly the same value, but $bundle makes more semantic sense in the context. If you really want to improve things here, then remove one of the variables all together. And provide a rationale for doing so.
Comment #4
Paul B commentedThe patch seems to solve my problem from https://drupal.org/node/2123701.
See screenshot.
Comment #5
mikran commentedThis lacks tests
Comment #5.0
mikran commentedCopied issue summary from https://drupal.org/node/2123701
Comment #6
adamgerthel commentedTried the patch but it didn't work as expected for me.
Comment #7
milesw commentedLooks like there are a couple things going on:
1. Patch #2 fixes what is definitely a bug. The extra properties are being added to the wrong bundle. Instead of being added to the relation bundle, they're added to the bundle of the endpoint.
2. The "getter callback",
relation_rules_get_specific_endpoints(), returns ALL endpoints instead of endpoints of the specified type.These two things can really screw with Rules, Search API, etc. and are quite difficult to debug. The common symptom seems to be exceptions like:
Here is a patch to address parts. Probably needs tests as @mikran mentioned.
Comment #8
Paul B commentedComment #9
mikran commentedI'll do something to the getter callbacks
Comment #10
mikran commentedAfter further investigation I found out that d.o testbots are not even running these rules tests so the first priority is to get those running properly #2597055: Relation Rules tests are not working.
Comment #12
socialnicheguru commentedthe patch does not apply to 11/2015 dev version
Comment #13
edvanleeuwenI have applied the patch to the latest stable version. Now I am able to see the names of the endpoints and use them in a rule. However, during execution they are not populated.
Comment #14
djdevinI rerolled this against the latest -dev and it did seem to work. I used it to make a rule that checks a role on the user being related before taking an action on the related user.
e.g., relation:endpoints-target-user:0 is now treated as a user in Rules.
Comment #16
djdevinI think I discovered what @edvanleeuwen saw, the properties are there but the data never is.
entity_metadata_wrapper needs an entity as the 2nd argument so it isn't loading any data - just the properties.