MAPG-140 add UserConfirmation model and repository and adapt SignupController

This commit is contained in:
bence committed 2020-06-20 02:03:11 +02:00
1 parent bd46809d3a
commit 0bf6e900fe
3 files changed
+88 -25

No files matched your search

@@ -0,0 +1,28 @@
<?php namespace MapGuesser\Repository;
use MapGuesser\Database\Query\Select;
use MapGuesser\PersistentData\Model\UserConfirmation;
use MapGuesser\PersistentData\PersistentDataManager;
class UserConfirmationRepository
{
private PersistentDataManager $pdm;
public function __construct()
{
$this->pdm = new PersistentDataManager();
}
public function getById(int $userConfirmationId): ?UserConfirmation
{
return $this->pdm->selectFromDbById($userConfirmationId, UserConfirmation::class);
}
public function getByToken(string $token): ?UserConfirmation
{
$select = new Select(\Container::$dbConnection);
$select->where('token', '=', $token);
return $this->pdm->selectFromDb($select, UserConfirmation::class);
}
}