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

Model Relationship clarifcation related to data fetching

Say I have a table "A" with certain data and it has one-to-many relationship with table "B".

I would add following relatinship in MODEL A :

 $this->belongsTo('idfromB', __NAMESPACE__ . '\TableB', 'id', [
          'alias' => 'Tab',
          'reusable' => true
      ]);

So, here say tableB is quite large, with many thousands of records. If I run following :

 $dataA = tableA::find();

Then ofcourse $dataA will have all the records from tableA, will it also query all records from tableB at same time whether we are using those or not ?

Also , what exactly 'resusable' => true implies here ?

tableA::find() only query tableA without relationships

reusable => true make reusable same related records with tableA docs

Good luck