I am trying to get results similar to Yii1 while using ‘together’ in the relations.
Here is an example:
$user = User::find()->joinWith(['role'])->one(); echo $user->role->name;
On mysql log I see:
140806 12:53:29 59 Connect root@localhost on testDB 59 Query SET NAMES 'utf8' 59 Query SELECT `user`.* FROM `user` LEFT JOIN `role` ON `user`.`role_id` = `role`.`id` 59 Query SHOW FULL COLUMNS FROM `user` 59 Query SHOW CREATE TABLE `user` 59 Query SELECT * FROM `role` WHERE `id`='2' 59 Query SHOW FULL COLUMNS FROM `role` 59 Query SHOW CREATE TABLE `role` 59 Quit
I think joinwith() fails to populate the relation after using JOIN?