Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i want to copy a field from one entity to another while processing a rule. my current code looks like this:

    $entity_created->field_ort = $entity_fetched->field_ort;

but instead i get an error message:

Notice: Trying to get property of non-object in eval() (Zeile 3 von /www/www/sites/all/modules/rules/modules/php.eval.inc(125) : eval()'d code).

so i found this site http://drupal.org/node/1000200 which tells me that i need to do this more like this:

    $entity_created->field_ort['und'][0]['value'] = $entity_fetched->field_ort['und'][0]['value'];

but what about lists and other fields? is there a more generic approach? i need to copy about 5 or more fields.

share|improve this question
up vote 0 down vote accepted

That issue and the following code seems to have no bearing on the opening problem. Trying to get property of non-object, it literally means that $entity_fetched is not an object. Dump it into a file to see what it is.

share|improve this answer
yes, you are right... $entity_fetched is a List of Entities... right below it i used $entity_fetched[0]->field... and totaly oversaw that – reox Jan 16 '13 at 8:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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