$model = new StatReport();
$builder = $model->getModelsManager()->createBuilder()->from(get_class($model));
// $results = $builder->columns('report_at')
$results = $builder->columns('DATE_FORMAT(report_at,"%x%v") AS test')
->where('report_at> "2018-09-08"')
->groupBy('test')
// ->groupBy('report_at')
->getQuery()->execute();
$paginator = new \Phalcon\Paginator\Adapter\QueryBuilder(array(
"builder" => $builder,
"limit"=> 10,
"page" => 1,
));
var_dump($paginator->getPaginate()->items->toArray());
throw:
Column 'test' doesn't belong to any of the selected models (1), when preparing: SELECT COUNT(DISTINCT test) AS [rowcount] FROM [StatReport] WHERE report_at> "2018-09-08"
if not use paginate or not use DATA_FORMAT, it work
how can i fix this problem?
my phalcon version is 3.3.1
thx