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

Model alias in static query method

Is there a way to set Alias of current model which i working with ? I am doing leftJoin and i have 2 columns same called("id") so i have to Alias current model, but using ::query() i dont see such a option...... i know i can use modelsManager but query just looks better and i dont have to get modelsManager from DI.

I'm not too familiar, but have you tried just using the "AS" functionality? Something like:

SELECT
    *
FROM
    ModelOne as One,
    ModelTwo as Two

I'm not sure if PHQL supports that - I would guess so.

Yea i know its supporting, you dont know what i mean :P There is no way in Model::query() for setting this Model alias :P