Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

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

 
discard

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

Browse other questions tagged or ask your own question.