src/Model/Table/UsersTable.php
public function findWithGroupName(Query $query)
    {
        return $query
            ->select([
                'id',
                'username',
                'email',
                'verified',
                'active'
            ])
            ->contain([
                'Groups' => function (Query $q) {
                    return $q->select(['name']);
                }
            ]);
    }
public function findWithGroupName(Query $query)
    {
        return $query
            ->select([
                'id',
                'username',
                'email',
                'verified',
                'active'
            ])
            ->contain([
                'Groups' => function (Query $q) {
                    return $q->select(['name']);
                }
            ]);
    }
public function findWithGroupName ( Query $ query ) { return $ query -> select ( [ 'id' , 'username' , 'email' , 'verified' , 'active' ] ) -> contain ( [ 'Groups' => function ( Query $ q ) { return $ q -> select ( [ 'name' ] ) ; } ] ) ; }
Find users including their group name.

@param Query $query The query to decorate.
@return Query
Find users including their group name .