mysql - Get all current joins to a query in yii2 ActiveQuery -
is there way joined table query?
for example:
query = account::find()->joinwith(['gallery'])->joinwith(['articles'])->etc... is there integrated method in yii2 return above joined tables (or event on hook them manually)?
solution suggested @beowulfenator shows joins relations (which added joinwith() method.
to show joins need prepare query this:
$query = account::find() ->join('...', '...') ->joinwith(['gallery', 'articles']); // way, can reduce code $query->prepare(); this transform yii\db\activequery simple yii\db\query doesn't have joinwith property has join property show joins.
you can var_dump , see it:
var_dump($query->join); exit(); first element stores type of join, second - table name (note can either string or array depending on used relation), third - on condition.
Comments
Post a Comment