Example #1
0
 /**
  * Create a new League object, given the set of initial attribute values.
  * @param name the name of the league
  * @param leagueRules the rules of participating in the league
  * @param matchRules the match rules for matches played in the league
  * @param isIndoor is the league an indoor league?
  * @param minTeams the minimum number of teams in the league
  * @param maxTeams the maximum number of teams in the league
  * @param minPlayers the minimum number of players in teams in the league
  * @param maxPlayers the maximum number of players in teams in the league
  * @return a new League instance with the given attribute values
  * @throws RDException in case either the name is null or any of the team/player numbers is not positive or the given maximum is less than the corresponding minimum
  */
 public function createLeague($name = null, $leagueRules = null, $matchRules = null, $isIndoor = null, $minTeams = null, $maxTeams = null, $minPlayers = null, $maxPlayers = null)
 {
     $aLeague = new Entity\LeagueImpl();
     // if ($name != null && $leagueRules != null && $matchRules && $isIndoor != null &&
     //   $minTeams != null && $maxTeams != null && $minPlayers != null && $maxPlayers != null) {
     $aLeague->setName($name);
     $aLeague->setLeagueRules($leagueRules);
     $aLeague->setMatchRules($matchRules);
     $aLeague->setIsIndoor($isIndoor);
     $aLeague->setMinTeams($minTeams);
     $aLeague->setMaxTeams($maxTeams);
     $aLeague->setMinMembers($minPlayers);
     $aLeague->setMaxMembers($maxPlayers);
     // }
     return $aLeague;
 }
Example #2
0
 public function updateLeague($leagueName, $newName = null, $leagueRules = null, $matchRules = null, $isIndoor = null, $minTeams = null, $maxTeams = null, $minMembers = null, $maxMembers = null, $winnerOfLeague = null)
 {
     $leagueModel = new Entity\LeagueImpl();
     $leagueModel->setName($leagueName);
     $leagueIter = $this->objectLayer->findLeague($leagueModel);
     if ($leagueIter->size() <= 0) {
         throw new RDException($string = "League not found");
     } else {
         $league = $leagueIter->current();
         if ($newName != null) {
             $league->setName($newName);
         }
         if ($leagueRules != null) {
             $league->setLeagueRules($leagueRules);
         }
         if ($matchRules != null) {
             $league->setMatchRules($matchRules);
         }
         if ($isIndoor != null) {
             $league->setIsIndoor($isIndoor);
         }
         if ($minTeams != null) {
             $league->setMinTeams($minTeams);
         }
         if ($maxTeams != null) {
             $league->setMaxTeams($maxTeams);
         }
         if ($minMembers != null) {
             $league->setMinMembers($minMembers);
         }
         if ($maxMembers != null) {
             $league->setMaxMembers($minMembers);
         }
         if ($winnerOfLeague != null) {
             $league->setWinnerOfLeague($winnerOfLeague);
         }
         $this->objectLayer->storeLeague($league);
     }
 }