*/ class ConfigMapper extends QBMapper { public function __construct(IDBConnection $db) { parent::__construct($db, 'mcs_config', Config::class); } /** * @throws DoesNotExistException */ public function findByUserId(string $userId): Config { $qb = $this->db->getQueryBuilder(); $qb->select('*') ->from($this->getTableName()) ->where($qb->expr()->eq('user_id', $qb->createNamedParameter($userId))); return $this->findEntity($qb); } /** * @return Config[] */ public function findAllEnabled(): array { $qb = $this->db->getQueryBuilder(); $qb->select('*') ->from($this->getTableName()) ->where($qb->expr()->eq('enabled', $qb->createNamedParameter(1, IQueryBuilder::PARAM_INT))); return $this->findEntities($qb); } }