/** * Finds user by [[username]] * * @return User|null */ public function getUser() { if ($this->_user === false) { $this->_user = Player::findByMail($this->email); } return $this->_user; }
private function performPlayerMailSearch($player_mail) { if (empty($player_mail)) { return array(); } if ($player = \app\models\Player::findByMail($player_mail)) { return $player->teams; } return array(); }
/** * When team is updated, link/unlink players with team */ private function manageTeamMembers() { if ($this->isNewRecord) { return; } if ($player = Player::findByMail($this->join_player)) { $this->link('players', $player); } if ($player = Player::findByMail($this->remove_player)) { $this->unlink('players', $player, true); } }