We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

How to implement JOIN in phalcon ORM

How can we implement join queries in phalcon ORM without using direct PHQL queries.



98.8k

You can use the QueryBuilder:

$robots = $this->modelsManager->createBuilder()
    ->from('Robots')
    ->join('RobotsParts')
    ->order('Robots.name')
    ->getQuery()
    ->execute();

http://docs.phalcon.io/en/1.1.0/reference/phql.html#creating-queries-using-the-query-builder