I'm write a simple code in sonata admin with createQuery() for configureListFields().
When I write groupby , I get the following error:
The query returned multiple rows. Change the query or use a different result function like
getScalarResult().
public function createQuery($context = 'list')
{
$query = parent::createQuery($context);
$rootAlias = $query->getRootAliases()[0];
$query->groupby($rootAlias.'.cityId');
return $query;
}