Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions lib/Db/MailAccountMapper.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

/**
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
Expand Down Expand Up @@ -43,26 +44,25 @@ public function __construct(IDBConnection $db) {
*
* @return MailAccount
*/
public function find($userId, $accountId) {
public function find(string $userId, int $accountId): MailAccount {
$qb = $this->db->getQueryBuilder();
$query = $qb
->select('*')
->from($this->getTableName())
->where($qb->expr()->eq('user_id', $qb->createNamedParameter($userId)))
->andWhere($qb->expr()->eq('id', $qb->createNamedParameter($accountId)));

return $this->findEntity($qb);
return $this->findEntity($query);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

/**
* Finds all Mail Accounts by user id existing for this user
*
* @param string $userId the id of the user that we want to find
* @param $userId
*
* @return MailAccount[]
*/
public function findByUserId($userId) {
public function findByUserId(string $userId): array {
$qb = $this->db->getQueryBuilder();
$query = $qb
->select('*')
Expand All @@ -79,7 +79,7 @@ public function findByUserId($userId) {
*
* @return MailAccount
*/
public function save(MailAccount $account) {
public function save(MailAccount $account): MailAccount {
if (is_null($account->getId())) {
return $this->insert($account);
} else {
Expand Down