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

findFirst with LEFT JOIN

Hi,

I'm trying to make use LEFT JOIN in findFirst using User::query() function but there is no result containing any of the required data. Could anyone point me to a right direction?

Thanks!



2.1k
edited Jan '15

https://docs.phalcon.io/en/latest/reference/phql.html

$query = "select model1.*, model2.* from model1 left join model2";

make sure your relationship is declared else you need to explicitly declare the link. =)