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

Columns with alias in find

Why is that I can't do this:

colums => 'MONTH(date) as month' in the my find?

I can do it in a query, but i would like to do it in the find function There is no error, just that month dosent get set..

Hmm, this is working as intended for me:

News::findFirst([
   'columns' => ['YEAR(created_at) AS yearOnly']
])->toArray();

// Outputs
Array
(
    [yearOnly] => 2016
)

Check your spelling. Columns has an "n" in it, which makes no sense, but that's English for you.