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

How to implement JOIN in phalcon ORM

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



98.9k

You can use the QueryBuilder:

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

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