Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
hasGroupBy example
if
(
$sorting
instanceof CountSorting
)
{
$query
->
addOrderBy
(
sprintf
(
'COUNT(%s)',
$accessor
)
,
$sorting
->
getDirection
(
)
)
;
continue
;
}
if
(
$sorting
->
getNaturalSorting
(
)
)
{
$query
->
addOrderBy
(
'LENGTH(' .
$accessor
. ')',
$sorting
->
getDirection
(
)
)
;
}
if
(
!
$this
->
hasGroupBy
(
$criteria
,
$query
)
)
{
$query
->
addOrderBy
(
$accessor
,
$sorting
->
getDirection
(
)
)
;
continue
;
}
if
(
!\
in_array
(
$sorting
->
getField
(
)
,
[
'product.cheapestPrice', 'cheapestPrice'
]
, true
)
)
{
if
(
$sorting
->
getDirection
(
)
=== FieldSorting::ASCENDING
)
{
$accessor
= 'MIN(' .
$accessor
. ')';
}
else
{
$accessor
= 'MAX(' .
$accessor
. ')';
}
}