public function findUserIdsWithOnlyOneGroup()
    {
        $query = $this->find();
        return $query
            ->select([
                'user_id',
                'group_count' => $query->func()->count('*')
            ])
            ->group('user_id')
            ->having([
                'group_count = 1'
            ])
            ->extract('user_id')
            ->toArray();
    }
public function findUserIdsWithOnlyOneGroup()
    {
        $query = $this->find();
        return $query
            ->select([
                'user_id',
                'group_count' => $query->func()->count('*')
            ])
            ->group('user_id')
            ->having([
                'group_count = 1'
            ])
            ->extract('user_id')
            ->toArray();
    }
public function findUserIdsWithOnlyOneGroup ( ) { $ query = $ this -> find ( ) ; return $ query -> select ( [ 'user_id' , 'group_count' => $ query -> func ( ) -> count ( '*' ) ] ) -> group ( 'user_id' ) -> having ( [ 'group_count = 1' ] ) -> extract ( 'user_id' ) -> toArray ( ) ; }
Find all user ids of users assigned to only one group.

@return array
Find all user ids of users assigned to only one group .