*/ class ProposalMapper extends QBMapper { public function __construct( IDBConnection $db, ) { $this->tableName = 'calendar_proposal_dts'; parent::__construct($db, $this->tableName, ProposalDetailsEntry::class); } public function fetchById(string $userId, int $id): ?ProposalDetailsEntry { $qb = $this->db->getQueryBuilder(); $qb->select('*') ->from($this->tableName) ->where( $qb->expr()->eq('uid', $qb->createNamedParameter($userId, IQueryBuilder::PARAM_STR)), $qb->expr()->eq('id', $qb->createNamedParameter($id, IQueryBuilder::PARAM_INT)) ); return $this->findEntity($qb); } public function fetchByUserId(string $userId): array { $qb = $this->db->getQueryBuilder(); $qb->select('*') ->from($this->tableName) ->where( $qb->expr()->eq('uid', $qb->createNamedParameter($userId, IQueryBuilder::PARAM_STR)) ); return $this->findEntities($qb); } public function deleteById(string $userId, int $id): void { $qb = $this->db->getQueryBuilder(); $qb->delete($this->tableName) ->where( $qb->expr()->eq('uid', $qb->createNamedParameter($userId, IQueryBuilder::PARAM_STR)), $qb->expr()->eq('id', $qb->createNamedParameter($id, IQueryBuilder::PARAM_INT)) ); $qb->executeStatement(); } public function deleteByUserId(string $userId): void { $qb = $this->db->getQueryBuilder(); $qb->delete($this->tableName) ->where( $qb->expr()->eq('uid', $qb->createNamedParameter($userId, IQueryBuilder::PARAM_STR)) ); $qb->executeStatement(); } }