You are here

public function OAuth2ServerTokenEntityController::save in OAuth2 Server 7

Overrides EntityAPIController::save().

Overrides EntityAPIController::save

File

includes/oauth2_server.token_controller.inc, line 11

Class

OAuth2ServerTokenEntityController
The entity controller for oauth2_server_token entities.

Code

public function save($entity, DatabaseTransaction $transaction = NULL) {

  // Ensure that the token 'created' timestamp is saved, for new tokens.
  $entity->is_new = !empty($entity->is_new) || empty($entity->{$this->idKey});
  if ($entity->is_new && empty($entity->created)) {
    $entity->created = REQUEST_TIME;
  }
  return parent::save($entity, $transaction);
}