Phalcon performance related queries
I'm building a REST API for the output of endpoint /projects I have created 2 models: Projects: class Projects extends BaseModel { public function initialize() { $this->hasMany('id', 'Participants', 'projectId'); } } Participants: class Participants extends BaseModel { public function initialize() { $this->belongsTo('projectId', 'Projects', 'id'); } } Lets say, I have 10 projects: (1 query) $results = Projects::find(); I loop through all 10 of them, but I want all Participants too: foreach($results as $result) { echo $result->participants; // 1 query } So at the end of the loop Phalcon has