Answer the question
In order to leave comments, you need to log in
How to write conditions in with/joinWith?
Hello! I recently moved to yii2 and have a question about the conditions in with, more precisely, about adding aliases:
Here is the code:
User::find()
->with(['address' => function(ActiveQuery $addressQuery){
$addressQuery->where(['status' => 1]);
}])
->where(['status' => 1])
->all();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question