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

Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Phalcon Model Inner Join

Can any one share example of inner join using phalcon model query.



85.5k

MyModel::query()
->join('Robots', 'r.id = RobotsParts.robots_id', 'r', 'INNER');
->execute();

this should be working

https://docs.phalcon.io/en/latest/api/Phalcon_Mvc_Model_Query_Builder.html



14.6k
Accepted
answer

Thanks but it will give result after modifiying to this if you are using namespaces in models

MyModel::query()->join('path\to\your\Model', 'r.id=path\to\your\second\Model','r','INNER')->execute();

**My Model represents the model (table) from which you want to get data from.