Here’s an example from my own code, which works fine in the Articles table:
'className' => 'Categories',
'joinTable' => 'articles_categories',
'foreignKey' => 'article_id',
'targetForeignKey' => 'category_id',
In your case, you want the relation to be called Friends, not Categories. You want those friends to be Users, not Categories. You want the join table to be
targetForeignKey should be the fields from the join table, you should be able to see which one relates to the record that you’re finding associated record for (article_id in my case, should be user_id in yours, right?) and which relates to the records in the associated table (category_id in my case, peopleid in yours).
So, it really seems that it should be:
'className' => 'Users',
'joinTable' => 'peoples',
'foreignKey' => 'user_id',
'targetForeignKey' => 'peopleId',
which is what I had the first time. You didn’t change it from
belongsToMany to some other association, did you?