Hello, Thank you for reading it.
I’m studying cakephp and have a few questions about Join in Cakephp.
I coudn’t find any appropriate answer on internet
1, What is difference between innerjoin and innerjoinwith (like leftjoin and leftjoinwith) I thought It is related with performence issue, but couldn’t find any clue.
2, I can’t get the exact difference between “matching” and "contain"
I know the way they retrieving data is different, but I thought the result looks same as the result of matching and matching is using innerjoin, and contain is using leftjoin.
but but I can’t find what is the difference between the code below(using contain) and matching.
$query = $articles->find()->contain([
‘Comments’ => function ($q) {
return $q
->select([‘body’, ‘author_id’])
->where([‘Comments.approved’ => true]);
}
]);
3, what is “_matchingData” in matching?
I read this description, that is
"The innerJoinWith() method works the same as matching(), that means that you can use dot notation to join deeply nested associations: Again, the only difference is that no additional columns will be added to the result set, and no _matchingData property will be set."
but I couldn’t find any description about _matchingData. even in API… what it is?
you can response one of them, it is okay. please help me out