You are here

public function RateLimit::loadRateLimitEntity in RESTful 7.2

Load rate limit entity.

Parameters

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

Return value

RateLimitInterface The loaded entity or NULL if none found.

Overrides RateLimitInterface::loadRateLimitEntity

File

src/Plugin/rate_limit/RateLimit.php, line 117
Contains \Drupal\restful\Plugin\rate_limit\RateLimit

Class

RateLimit

Namespace

Drupal\restful\Plugin\rate_limit

Code

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