diff --git a/src/Repository/UserPasswordResetterRepository.php b/src/Repository/UserPasswordResetterRepository.php index 466c3c8..47c70d7 100644 --- a/src/Repository/UserPasswordResetterRepository.php +++ b/src/Repository/UserPasswordResetterRepository.php @@ -1,5 +1,7 @@ pdm->selectFromDb($select, UserPasswordResetter::class); } + + public function getAllExpired(): Generator + { + $select = new Select(\Container::$dbConnection); + $select->where('expires', '<', (new DateTime())->format('Y-m-d H:i:s')); + + yield from $this->pdm->selectMultipleFromDb($select, UserPasswordResetter::class); + } } diff --git a/src/Repository/UserRepository.php b/src/Repository/UserRepository.php index c7ddcaf..be96c79 100644 --- a/src/Repository/UserRepository.php +++ b/src/Repository/UserRepository.php @@ -1,5 +1,7 @@ pdm->selectFromDb($select, User::class); } + + public function getAllInactiveExpired(): Generator + { + $select = new Select(\Container::$dbConnection); + $select->where('active', '=', false); + $select->where('created', '<', (new DateTime('-1 day'))->format('Y-m-d H:i:s')); + + yield from $this->pdm->selectMultipleFromDb($select, User::class); + } }