As we know recursive has been removed from cakePHP 4.x but how to get data in 2-3 level ?
I have those tables
countries ( data of all countries )
users ( have country_id field )
applications ( have user_id field )
In Model > Table
ApplicationsTable have $this->belongsTo(‘Users’);
UsersTable have $this->belongsTo(‘Countries’);
Now in Controller
$this->paginate = [‘contain’ => [‘Users’],
‘limit’ => 100, ‘conditions’ => [‘Applications.project_id’ => $id], ‘order’ => [‘id’ => ‘desc’]];
$data = $this->paginate($this->Applications->find(‘all’));
now i have resultSet like
[0] => (
applicaiton table data
[user] => (
users data …
)
)
but i need country data under user (that we can do in cakephp 2 using recursive level 2 )
[0] => (
applicaiton table data …
[users] => (
users data …
[country] (
country data here …
)
)
)
Thanks