M
M
Maxim Grechushnikov2015-04-28 01:58:40
Yii
Maxim Grechushnikov, 2015-04-28 01:58:40

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]);
    });
  }

I don’t understand why the callback is not working %)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mishutka2000, 2015-04-28
@Mishutka2000


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 question

Ask a Question

731 491 924 answers to any question