You are here

function UserpointsTransaction::getEntity in User Points 7.2

Get the referenced entity, if any.

Return value

An entity object or NULL.

1 call to UserpointsTransaction::getEntity()
UserpointsTransaction::getReason in ./userpoints.transaction.inc
Returns a descriptive reason for this transaction.

File

./userpoints.transaction.inc, line 468
Contains the UserpointsTransaction and related classes.

Class

UserpointsTransaction
A Userpoints transaction.

Code

function getEntity() {
  if (!empty($this->entity_id) && !empty($this->entity_type) && entity_get_info($this->entity_type)) {

    // Create an array because array_shift passes in by reference.
    $entities = entity_load($this->entity_type, array(
      $this->entity_id,
    ));
    return array_shift($entities);
  }
}