Answer the question
In order to leave comments, you need to log in
Yii2, relation: When is callback executed?
public function getTeam(){
return $this->hasMany(self::className(), ['team_id'=>'id'], function($query){exit(123);
$query->andWhere(['team_status'=>self::STATUS_TEAM_APPROVED]);
});
}
Answer the question
In order to leave comments, you need to log in
function($query){ exit(123); $query->andWhere(['team_status'=>self::STATUS_TEAM_APPROVED]); }
The answer lies in exit(123)
The function stops without having time to do anything useful. Read more here manual PHP - exit
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question