public function RevocableTokenRepositoryTrait::persistNew in Simple OAuth (OAuth2) & OpenID Connect 8.2
Same name and namespace in other branches
- 8.4 src/Repositories/RevocableTokenRepositoryTrait.php \Drupal\simple_oauth\Repositories\RevocableTokenRepositoryTrait::persistNew()
- 8.3 src/Repositories/RevocableTokenRepositoryTrait.php \Drupal\simple_oauth\Repositories\RevocableTokenRepositoryTrait::persistNew()
- 5.x src/Repositories/RevocableTokenRepositoryTrait.php \Drupal\simple_oauth\Repositories\RevocableTokenRepositoryTrait::persistNew()
3 calls to RevocableTokenRepositoryTrait::persistNew()
- AccessTokenRepository::persistNewAccessToken in src/
Repositories/ AccessTokenRepository.php - AuthCodeRepository::persistNewAuthCode in simple_oauth_extras/
src/ Repositories/ AuthCodeRepository.php - RefreshTokenRepository::persistNewRefreshToken in src/
Repositories/ RefreshTokenRepository.php
File
- src/
Repositories/ RevocableTokenRepositoryTrait.php, line 37
Class
Namespace
Drupal\simple_oauth\RepositoriesCode
public function persistNew($token_entity) {
if (!is_a($token_entity, static::$entity_interface)) {
throw new \InvalidArgumentException(sprintf('%s does not implement %s.', get_class($token_entity), static::$entity_interface));
}
$values = $this->serializer
->normalize($token_entity);
$values['bundle'] = static::$bundle_id;
$new_token = $this->entityTypeManager
->getStorage(static::$entity_type_id)
->create($values);
$new_token
->save();
}