catfan / Medoo

The lightweight PHP database framework to accelerate the development.
https://medoo.in
MIT License
4.83k stars 1.15k forks source link

Adjust over 'group by array' for functions as MONTH(), DAY(), etc #907

Closed Oscarato closed 3 years ago

Oscarato commented 4 years ago

Describe the bug In array group, medoo show the next error: "Object of class Medoo\Raw could not be converted to string" $filter['GROUP'] = [ Medoo::raw('MONTH(d.start)') ];

I fixed on file Medoo.php on line 878:

foreach ($GROUP as $column => $value) { if ($raw = $this->buildRaw($value, $map)) { $stack[] = $raw; }else{ $stack[] = $this->columnQuote($value); } }

I don't have write permissions

Information

Detail Code $filter['GROUP'] = [ Medoo::raw('MONTH(d.start)') ];

Expected output Data array

catfan commented 3 years ago

Just use with raw object directly.

$where['GROUP'] => Medoo::raw('MONTH(d.start)')