We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

How to user PostgreSQL function in ORM?

If I execute this code:

$users = Users::count([
    'group' => 'date_trunc("day", register_date) as date',
    'order' => 'date desc',
]);

I get error, maybe I can user ORM for my example, not use raw sql.

What error you have? I just guess you need to add dialect extension check for example this:

https://github.com/phalcon/incubator/blob/master/Library/Phalcon/Db/Dialect/MysqlExtended.php