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

query builder returning only Membersdirectory columns

why my query builder returning only Membersdirectory columns and not showing Membersfile columns and data...

<?php

$sample = CB::createBuilder()
->from('Models\Membersdirectory')
->leftJoin('Models\Membersfile', 'Models\Membersdirectory.contentpath = Models\Membersfile.filepath')
->where('Models\Membersdirectory.directoryid = "36E7E533-C299-4290-851C-28257001DB1B"')
->getQuery()
->execute();

echo json_encode($sample->toArray());

?>
edited Apr '16

Beacause in this case phalcon is doing full hydration and you have objects Membersdirectory which have related entities. You can access Membersdirectory using alias you setted when defining relations.

But toArray() still should return data from Membersfile. What will happen if you just select some columns from Membersfile ? Is anything returned ?