I can’t tell right away what might be wrong. I always use the function chaining method for queries, not passing arguments. In your case, that would look something like this:
$results = $this->Users->find()
->contain(['Profiles'])
->where(['Profiles.name LIKE' => $name . '%'])
->limit(10);
I also never bother limiting the fields read, as it doesn’t seem to be a measurable performance hit, and it caused me more problems than it solved when I did try. So, I can’t say what that would be here. Something to do with the select
function, might be as simple as ->select(['id', 'Profiles.name'])
.