Load model inside another model CakePhp 3

Hi can some one explain me how to load a model inside another model in cakephp 3

Thanks

Check the cook book http://book.cakephp.org/3.0/en/orm/query-builder.html

You should find contain and matching

As per Cook Book Example you can use the TableRegistry to access a model, So

use Cake\ORM\TableRegistry;
$this->Table = TableRegistry::get('Table');

You can use this to load model in another model.

2 Likes