How to order posts, when I must create CASE statment for priority ?
example CASE:
$priority = $query->newExpr()
->addCase(
[
$query->newExpr()->add(['Posts.source' => 'admin'])
],
[1, 0],
['integer', 'integer']
);
$query->select([
// .. all fields then :
'Postings__priority' => $priority,
])
$this->paginate = [
'limit' => 50,
'order' => [
'Posts.premium' => 'DESC',
'Posts__priority' => 'DESC',
'Posts.cpc' => 'DESC'
],
];
// ...
Problem:
Query return only one post where is ‘Posts.source’ => ‘admin’, without other 0 priority posts .
Any Hint, welcome.