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" } }
        }
      }
    ]
  }
}

Comments

Channel Islander’s picture

Issue summary: View changes
bdecarne’s picture

Hi,

There is a missing method in the MembershipEntityTerm class. Look at the attached patch.

Regards,

feldmarv’s picture

#2 works as expected!

joelstein’s picture

Title: Fatal error: Call to undefined method MembershipEntityTerm::membership() » Mission getter and setter methods for 'membership' property in MembershipEntityTerm class
Status: Active » Needs review
StatusFileSize
new872 bytes

The 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.

  • draenen committed 7593a74 on 7.x-1.x authored by joelstein
    Issue #2414001 by bdecarne, joelstein: Mission getter and setter methods...
draenen’s picture

Status: Needs review » Fixed

Committed. Thanks!

Status: Fixed » Closed (fixed)

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