db->getQueryBuilder(); $qb->select('r.*', 'g.displayname as groupName') ->from($this->tableName, 'r') ->leftJoin('r', 'groups', 'g', $qb->expr()->eq('r.group_id', 'g.gid')) ->where($qb->expr()->eq('id', $qb->createNamedParameter($id, IQueryBuilder::PARAM_INT))); return $this->findEntity($qb); } /** * @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException * @throws DoesNotExistException */ public function findByGroupId(string $groupId): Restriction { /* @var $qb IQueryBuilder */ $qb = $this->db->getQueryBuilder(); $qb->select('r.*', 'g.displayname as groupName') ->from($this->tableName, 'r') ->leftJoin('r', 'groups', 'g', $qb->expr()->eq('r.group_id', 'g.gid')) ->where($qb->expr()->eq('group_id', $qb->createNamedParameter($groupId))); return $this->findEntity($qb); } /** * @return array */ public function findByGroupIds(array $groupIds): array { /* @var $qb IQueryBuilder */ $qb = $this->db->getQueryBuilder(); $qb->select('r.*', 'g.displayname as groupName') ->from($this->tableName, 'r') ->leftJoin('r', 'groups', 'g', $qb->expr()->eq('r.group_id', 'g.gid')) ->where($qb->expr()->in('group_id', $qb->createNamedParameter($groupIds, IQueryBuilder::PARAM_STR_ARRAY))); /** @var array */ return $this->findEntities($qb); } /** * @return array */ public function findAll(): array { /* @var $qb IQueryBuilder */ $qb = $this->db->getQueryBuilder(); $qb->select('r.*', 'g.displayname as groupName') ->from($this->tableName, 'r') ->leftJoin('r', 'groups', 'g', $qb->expr()->eq('r.group_id', 'g.gid')); /** @var array */ return $this->findEntities($qb); } }