Results not showing if "hasOne" associated data does not exist

Hi,

Using this example.

User hasOne Address
Address belongsTo Countries

  1. If I do a search as below, users which has no address will not be shown.

$this->Users->find()->contain([ 'Address.Countries' ]);

  1. But if I do a search without ‘Countries’, all Users will be shown.

$this->Users->find()->contain([ 'Address' ]);

I was expecting when I do the search #1, all users will be shown regardless of whether there is an Address. Am I missing something ?

I can’t remember if there’s a difference between ->contain(['Address.Countries']) and ->contain(['Address' => ['Countries']]). Can you try the latter and see if it changes anything?

sorry, my mistake. In the Model/Table, the belongsTo was set to INNER

'joinType' => 'INNER',