db->getQueryBuilder(); $qb->select('*') ->from('favorites') ->where($qb->expr()->eq('id', $qb->createNamedParameter($id, IQueryBuilder::PARAM_INT))) ->andWhere($qb->expr()->eq('user_id', $qb->createNamedParameter($userId))); return $this->findEntity($qb); } /** * @param string $userId * @return array */ public function findAll(string $userId): array { /* @var $qb IQueryBuilder */ $qb = $this->db->getQueryBuilder(); $qb->select('*') ->from('favorites') ->where($qb->expr()->eq('user_id', $qb->createNamedParameter($userId))); return $this->findEntities($qb); } }