Skip to content

Instantly share code, notes, and snippets.

@init90
Last active May 5, 2018 21:06
Show Gist options
  • Select an option

  • Save init90/3a4488a7036294db4aca335e6288e5f9 to your computer and use it in GitHub Desktop.

Select an option

Save init90/3a4488a7036294db4aca335e6288e5f9 to your computer and use it in GitHub Desktop.
drupal 7, entity query by date and entity reference field.
$q = new EntityFieldQuery;
$exam_id = $exam_wrp->field_event_exan_id->value();
$assignee_user = $q->entityCondition('entity_type', 'event')
->propertyCondition('type', 'exam_event')
->fieldCondition('field_start_event_date', 'value', date('Y-m-d'), '>')
->fieldCondition('field_event_exan_id', 'value', $exam_id, '=')
->fieldCondition('field_assignee', 'target_id', array($GLOBALS['user']->uid), 'IN')
->execute();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment