I'm having troubles to fetch computed columns using the query builder. My concrete situtation is the following : I've an user list and I want to display in this list if the member is logged in or not. So my computation is currently based on the last activity user's. Something like :
SELECT username, (TIMESTAMPDIFF(MINUTE, TIMESTAMP(last_activity), CURRENT_TIMESTAMP()) < 20) AS logged_in FROM user LIMIT 30;
But how can I use the query builder ? This is an important point because I've built my own model layer over the phalcon models. It allows me to fetch every columns I want in every models with automatic joins. All columns, except computed columns :(
Here is the link to the referred doc : http://docs.phalcon.io/en/latest/api/Phalcon_Mvc_Model_Query_Builder.html. As you can see, there is no case explained about fetching computed columns.
Any idea ?
Thanks in advance for your help!