You are here

public function RestfulRateLimitBase::loadRateLimitEntity in RESTful 7

Load rate limit entity.

Parameters

\stdClass $account: The account object for the user making the request.

Return value

\RestfulRateLimit The loaded entity or NULL if none found.

File

plugins/rate_limit/RestfulRateLimitBase.php, line 141
Contains \RestfulRateLimitBase

Class

RestfulRateLimitBase
@file Contains \RestfulRateLimitBase

Code

public function loadRateLimitEntity(\stdClass $account = NULL) {
  $query = new \EntityFieldQuery();
  $results = $query
    ->entityCondition('entity_type', 'rate_limit')
    ->entityCondition('bundle', $this->name)
    ->propertyCondition('identifier', $this
    ->generateIdentifier($account))
    ->execute();
  if (empty($results['rate_limit'])) {
    return;
  }
  $rlid = key($results['rate_limit']);
  return entity_load_single('rate_limit', $rlid);
}