I have a table Users that has many Questions. For ex.:
id, name, email
id, user_id, question
When i use find query using UsersTable that “contain” Questions, then it doesn’t make any join in SQL.
But when i use find query using QuestionsTable that “contain” Users, then does join and builds sql as required.
I don’t understand why?
My query is:
$UsersTable = TableRegistry::get(‘Users’);
$user_questions = $UsersTable ->find(‘all’ , [ ‘conditions’ => [‘Users.id’ => 1] ]) ->contain([‘Questions’]);