You are here

public function EntityLegalDocumentController::getAllVersions in Entity Legal 7

Same name and namespace in other branches
  1. 7.2 entity_legal.entity_controller.inc \EntityLegalDocumentController::getAllVersions()

Get all versions of a legal document entity.

Parameters

EntityLegalDocument $entity: The legal document entity to get versions of.

Return value

array All versions of this legal document entity.

File

./entity_legal.entity_controller.inc, line 93
Entity API controller classes for entity_legal module.

Class

EntityLegalDocumentController
Entity Legal Document controller class.

Code

public function getAllVersions(EntityLegalDocument $entity) {
  $query = new EntityFieldQuery();
  $query
    ->entityCondition('entity_type', ENTITY_LEGAL_DOCUMENT_VERSION_ENTITY_NAME)
    ->propertyCondition('document_name', $entity
    ->identifier());
  $results = $query
    ->execute();
  if (!empty($results)) {
    return entity_load(ENTITY_LEGAL_DOCUMENT_VERSION_ENTITY_NAME, array_keys($results[ENTITY_LEGAL_DOCUMENT_VERSION_ENTITY_NAME]));
  }
  else {
    return array();
  }
}