Dear all,
If I limit returned fields like below, I can not get contained associations
$users = $this->Users->find('all', ['fields' => ['id', 'firstname', 'lastname', 'vaccination_id', 'health_id'],
'contain' => ['Vaccinations', 'Healths']
,'order' => ['firstname' => 'ASC']
,'conditions' => ['is_active' => true, 'is_deleted' => false
]
])->all();
If I remove the ‘fields’ option, then Vaccinations and Healths can be retrieve and printed name in view, as below
$users = $this->Users->find('all', [
'contain' => ['Vaccinations', 'Healths']
,'order' => ['firstname' => 'ASC']
,'conditions' => ['is_active' => true, 'is_deleted' => false
,'Users.id' => 154
]
])->all();
Is this a bug?