When creating a Reaction Rule for the event "After updating an existing membership term", the Data Selector gives access to:
membership-entity-term:membership:primary-member
But then when the Rule attempts to fire, the system throws a fatal error:
Fatal error: Call to undefined method MembershipEntityTerm::membership() in /sites/all/modules/contrib/entity/includes/entity.property.inc on line 426
I was suspicious of the Data Selector ... following convention, shouldn't it have been membership-entity-term:membership-entity:primary-member ? but when I tried to use that name for the Data Value it was not accepted.
I also got a similar Fatal error when attempting to save a programmatically created Term using a custom PHP snippet:
Fatal error: Call to undefined method MembershipEntityTerm::setmembership() in /sites/all/modules/contrib/entity/includes/entity.property.inc on line 437 as reported here.
I am no PHP programmer but it seems to me that Membership Entity Term is not registered somewhere it needs to be ... ?
Copy of the Rule:
{ "rules_mainsheet_subscription_remove_mainsheet_role_on_membership" : {
"LABEL" : "Mainsheet Subscription: Remove Mainsheet role on Membership expiration",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"TAGS" : [ "Memberships" ],
"REQUIRES" : [ "rules", "membership_entity_term" ],
"ON" : { "membership_entity_term_update" : [] },
"IF" : [
{ "user_has_role" : {
"account" : [ "membership-entity-term:membership:primary-member" ],
"roles" : { "value" : { "4" : "4" } }
}
},
{ "NOT user_has_role" : {
"account" : [ "membership-entity-term:membership:primary-member" ],
"roles" : { "value" : { "6" : "6" } }
}
}
],
"DO" : [
{ "user_remove_role" : {
"account" : [ "membership-entity-term:membership:primary-member" ],
"roles" : { "value" : { "4" : "4" } }
}
}
]
}
}| Comment | File | Size | Author |
|---|---|---|---|
| #4 | membership_entity-missing-getter-setter-membership-entity-term-2414001-4.patch | 872 bytes | joelstein |
Comments
Comment #1
Channel Islander commentedComment #2
bdecarne commentedHi,
There is a missing method in the MembershipEntityTerm class. Look at the attached patch.
Regards,
Comment #3
feldmarv commented#2 works as expected!
Comment #4
joelstein commentedThe patch in #2 helped, but it did not address the missing MembershipEntityTerm::setmembership().
The attached patch provides getter and setter methods for the 'membership' property on Membership Entity Terms.
Comment #6
draenen commentedCommitted. Thanks!