How to implement JOIN in phalcon ORM

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



83.4k

You can use the QueryBuilder:

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

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