this question has answer here:
i have query:
$popular = self::find() ->from(self::tablename() . ' t') ->with('user'); when try print sql:
$popular->createcommand()->rawsql it gives me:
select * "themes" "t" so can full raw query "join":
select * "themes" "t" left join "users" u on u.user_id = t.author_id
it's answered here.
you can var_dump generated sql activequery instances this:
var_dump($query->prepare(yii::$app->db->querybuilder)->createcommand()->rawsql); however, recommend use built-in debug model , panel.
p.s. particular query - with() not perform join, instead performs additional query , fills relation attributes actual related records. use join, need explicitly specify example joinwith().
Comments
Post a Comment