0

I've been trying every angle I can, but I keep running into Revision ID errors when I try to update a referenced or related entity of another entity. I believe this might be on the right track? I'm not sure why these are occurring. I just need a simple field to be updated when the related entity is updated.

It also throws this error: DatabaseTransactionNoActiveException

Is there any documentation on how to update one entity when another is updated? I just need to be pointed to the right track on this one.

2
  • Hello, and welcome to Drupal Answers. May you show your code? Without seeing any code, it is not possible to say what is wrong in the code.
    – apaderno
    Commented Jan 2, 2013 at 11:07
  • I think that's my question, I have a custom module already set up and ready to code, I'm just not sure where to start with this. I get this error (It's an undefined property error) when trying to use either Rules or with this Entity Reference Sync module. I prefer code but being fairly new to Drupal it's hasn't been easy to find documentation on certain things :/ Oddly enough I also get a Revision ID error when I run the update.php file.
    – jhoffmcd
    Commented Jan 2, 2013 at 18:34

1 Answer 1

1

Okay figured it out. I needed to patch the Redhen module I'm using which was causing a Revision ID error. Im using the Relation, Rules Redhen modules together (and of course the Entity API). Here is the export of the Rule that did it:

{ "rules_update_employment_status" : {
"LABEL" : "Update Employment Status",
"PLUGIN" : "reaction rule",
"REQUIRES" : [ "rules", "relation" ],
"ON" : [ "relation_update" ],
"IF" : [
  { "entity_is_of_type" : { "entity" : [ "relation:endpoints:0" ], "type" : "redhen_contact" } },
  { "entity_has_field" : {
      "entity" : [ "relation:endpoints:0" ],
      "field" : "field_employment_status"
    }
  }
],
"DO" : [
  { "relation_rules_fetch_endpoint" : {
      "USING" : {
        "relation" : [ "relation" ],
        "entity_type" : "redhen_contact",
        "number" : "1"
      },
      "PROVIDE" : { "endpoint_fetched" : { "endpoint_fetched" : "Fetched Endpoint" } }
    }
  },
  { "data_set" : {
      "data" : [ "relation:endpoints:0:field-employment-status" ],
      "value" : "20"
    }
  },
  { "drupal_message" : { "message" : "[endpoint-fetched:full-name]\u0027s Employment Availability has been changed to [endpoint-fetched:field-employment-status]." } }
]
  }
}

This let me access whatever fields on the endpoint that I wanted then change them if I needed to.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.