Drupal Answers is a question and answer site for Drupal developers and administrators. Join them; it only takes a minute:

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'd like to patch a contributed module that has a nasty bug. Is it true that we can't use fieldCondition() for expressions (e.g. a + b < 10)?

This is the code I am using.

  $query = new EntityFieldQuery();
  $query->entityCondition('entity_type', 'node')
    ->fieldCondition($field_name, 'runtime', 0, '!=')
    ->fieldCondition($field_name, 'runtime', $time, '+ node.created <') // BAD $operator!
    ->fieldCondition($field_name, 'active', 1, '=')
    ->propertyCondition('status', 1);
  $result = $query->execute();

According to the current API, it's not possible to use '+ node.created <' as an $operator. Is there anything I could use other than a complete rewrite of this (custom SQL)?

share|improve this question
why are you using this expression, what are you trying to achieve from this expression? Is it same as ($field_name['runtime']+node.created) < $time ?? – subhojit777 Jan 28 '13 at 4:09
Yes, it's the same as ($field_name['runtime']+node.created) < $time. – madjoe Jan 28 '13 at 9:08

Your Answer


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

Browse other questions tagged or ask your own question.