Skip to content

Commit

Permalink
Inject the user secret storage on the User model
Browse files Browse the repository at this point in the history
This enables us to load the user secret from the correct repository.
  • Loading branch information
MKodde committed Feb 8, 2022
1 parent 4577502 commit a5c6948
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/Tiqr/Legacy/TiqrUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ class TiqrUser implements TiqrUserInterface
private $userStorage;
private $userId;

public function __construct($userStorage, $userId)
public function __construct(Tiqr_UserStorage_Interface $userStorage, Tiqr_UserStorage_Interface $userSecretStorage, $userId)
{
$this->userStorage = $userStorage;
$this->userSecretStorage = $userSecretStorage;
$this->userId = $userId;
}

Expand All @@ -57,7 +58,7 @@ public function getDisplayName()
*/
public function getSecret()
{
return $this->userStorage->getSecret($this->userId);
return $this->userSecretStorage->getSecret($this->userId);
}

public function updateNotification($notificationType, $notificationAddress)
Expand Down
2 changes: 1 addition & 1 deletion src/Tiqr/Legacy/TiqrUserRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ public function getUser($userId)
if (!$this->userStorage->userExists($userId)) {
throw UserNotExistsException::createFromId($userId);
}
return new TiqrUser($this->userStorage, $userId);
return new TiqrUser($this->userStorage, $this->userSecretStorage, $userId);
}
}

0 comments on commit a5c6948

Please sign in to comment.