4

I'm trying to get all revisions of an entity with EntityFieldQuery.

Here's my code:

function entity_hash_queue($entity_restrict = NULL) {
  if ($entity_restrict) {
    $entity_info = entity_get_info($entity_restrict);
    if ($entity_info['entity keys']['revision'] != NULL) {
      $query = new EntityFieldQuery;
      $query->entityCondition('entity_type', $entity_restrict);
      $results = $query->execute();
    }
  }
}

I'm trying to figure out what property of the EntityFieldQuery object I can use to ensure that it gets every revision of an entity (if that entity supports revisions).

I'm getting a list of all entity objects, but not each revision for each object. How do I go about getting that information? I can't find anything.

1

In this case, use db_select instead EntityFieldQuery to get all revisions from the revision table:

$result = db_select('your_entity_revision_table', 'yert')
    ->fields('yert')
    ->condition('entity_id', {your Entity ID})
    ->execute()
    ->fetchAllAssoc('revision_id');

kpr($result);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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