/** * Finds games with empty points but with not empty score * @return int */ public function actionGetNull() { $tournaments = Tournaments::getAutoprocessTournaments(); $games = []; foreach ($tournaments as $one) { $teamTournament = TeamTournaments::find()->where(['id_tournament' => $one->id_tournament])->all(); //getting Participant IDs for the tournament $teamIDs = ArrayHelper::getColumn($teamTournament, 'id'); $games = ArrayHelper::merge($games, Games::find()->where(['or', ['in', 'id_team_home', $teamIDs], ['in', 'id_team_guest', $teamIDs]])->andWhere(['and', ['or', ['not', ['score_home' => null]], ['not', ['score_guest' => null]]], ['or', ['points_home' => null], ['points_guest' => null]]])->all()); } if (!empty($games)) { $this->getErrorMessage($games); } else { Yii::info('No games with score but with no points', 'console'); } return 0; }