Переделал проверку на try/catch

This commit is contained in:
Artem Vasilev 2024-03-08 02:19:04 +03:00
parent 78486a87a8
commit 6089848c68

View File

@ -42,10 +42,17 @@ class AccessTokenRepository implements AccessTokenRepositoryInterface
public function persistNewAccessToken(AccessTokenEntityInterface $accessTokenEntity): void
{
$found = false;
try {
/** @var AccessToken $accessTokenEntity */
$accessToken = $this->accessTokenModel->getItemByIdentifier($accessTokenEntity->getIdentifier());
if ($accessToken->id > 0) {
$found = true;
}
} catch (\Throwable $e) {
}
if ($found) {
throw UniqueTokenIdentifierConstraintViolationException::create();
}