*/ class TransferMapper extends QBMapper { public const TABLE_NAME = 'guests_transfers'; public function __construct(IDBConnection $db) { parent::__construct( $db, static::TABLE_NAME, Transfer::class, ); } /** * @throws DoesNotExistException */ public function getById(int $id): Transfer { $qb = $this->db->getQueryBuilder(); $qb->select('*') ->from(static::TABLE_NAME) ->where($qb->expr()->eq('id', $qb->createNamedParameter($id))); return $this->findEntity($qb); } /** * @throws DoesNotExistException */ public function getBySource(string $userId): Transfer { $qb = $this->db->getQueryBuilder(); $qb->select('*') ->from(static::TABLE_NAME) ->where($qb->expr()->eq('source', $qb->createNamedParameter($userId))); return $this->findEntity($qb); } /** * @throws DoesNotExistException */ public function getByTarget(string $userId): Transfer { $qb = $this->db->getQueryBuilder(); $qb->select('*') ->from(static::TABLE_NAME) ->where($qb->expr()->eq('target', $qb->createNamedParameter($userId))); return $this->findEntity($qb); } }