当前位置: 首页>>代码示例>>PHP>>正文


PHP Player::setFirstName方法代码示例

本文整理汇总了PHP中Player::setFirstName方法的典型用法代码示例。如果您正苦于以下问题:PHP Player::setFirstName方法的具体用法?PHP Player::setFirstName怎么用?PHP Player::setFirstName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Player的用法示例。


在下文中一共展示了Player::setFirstName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: load

 public function load()
 {
     $this->clear();
     // Alfredo Rodriguez (Maryland)
     $player = new Player();
     $player->setFirstName('Alfredo');
     $player->setLastName('Rodriguez');
     $player->setHeight(72);
     $player->setWeight(180);
     $player->setBats('R');
     $player->setThrows('R');
     $player->setHometown('Oak Hill, Va.');
     $player->setCstvId(395839);
     $player->setNcaaId(993788);
     $player->save();
     print_r(sprintf("Created Player: %s (%s)\n", $player->getName(), $player->getId()));
 }
开发者ID:bigjoevtrj,项目名称:codeigniter-bootstrap,代码行数:17,代码来源:player.php

示例2: saveTeamSeasonForPlayers

 protected function saveTeamSeasonForPlayers($players, $team)
 {
     $list = array();
     $this->CI->load->model('playerRepository', '_player');
     foreach ($players as $ncaaId => $stats) {
         $player = $this->CI->_player->findOneByNcaaId($ncaaId);
         $name = explode(',', $stats[0]);
         if (!$player) {
             $player = new Player();
             $player->setNcaaId($ncaaId);
             $player->setFirstName(trim($name[1]));
             $player->setLastName(trim($name[0]));
             $player->save();
         }
         if (!$player->getFirstName()) {
             $player->setFirstName(trim($name[1]));
         }
         if (!$player->getLastName()) {
             $player->setLastName(trim($name[0]));
         }
         $year = explode('-', $stats[2]);
         $year = date('Y', strtotime("january 1, " . $year[1]));
         if ($this->output) {
             print_r("Checking for Player Season with Year: " . $year . "\n");
         }
         $season = $player->getSeason($year);
         if (!$season) {
             if ($this->output) {
                 print_r("No Season for Player, Creating New Season\n");
             }
             $season = new Season();
         }
         $season->setYear($year);
         $season->setClass($stats[1]);
         $season->setPosition($stats[3]);
         $season->setTeam($team);
         $season->setGames($stats[4]);
         $season->setAtBats($stats[5]);
         $season->setRuns($stats[6]);
         $season->setHits($stats[7]);
         $season->setDoubles($stats[9]);
         $season->setTriples($stats[10]);
         $season->setHomeRuns($stats[11]);
         $season->setTotalBases($stats[12]);
         $season->setRunsBattedIn($stats[14]);
         $season->setStolenBases($stats[15]);
         $season->setStolenBaseAttempts($stats[16]);
         $season->setWalks($stats[17]);
         $season->setStrikeouts($stats[18]);
         $season->setHitByPitch($stats[19]);
         $season->setSacrificeHits($stats[20]);
         $season->setSacrificeFlies($stats[21]);
         $season->setAppearances($stats[22]);
         $season->setGamesStarted($stats[23]);
         $season->setCompleteGames($stats[24]);
         $season->setWins($stats[25]);
         $season->setLosses($stats[26]);
         $season->setSaves($stats[27]);
         $season->setShutouts($stats[28]);
         $season->setInningsPitched($stats[29]);
         $season->setHitsAllowed($stats[30]);
         $season->setRunsAllowed($stats[31]);
         $season->setEarnedRuns($stats[32]);
         $season->setWalksAllowed($stats[33]);
         $season->setStrikeoutsPitched($stats[34]);
         $player->addSeason($season);
         //print_r($player);
         //print_r('<br /><br />');
         $player->save();
         if ($this->output) {
             print_r("Player with Season:\n");
         }
         if ($this->output) {
             print_r($player);
         }
         $list[] = $player;
     }
     if ($this->output) {
         print_r("List of Players:\n");
     }
     if ($this->output) {
         print_r($list);
     }
     return $list;
 }
开发者ID:bigjoevtrj,项目名称:codeigniter-bootstrap,代码行数:85,代码来源:NcaaParse.php

示例3: importPitchers

 public function importPitchers($real = false, $year = 0)
 {
     if ($real) {
         $file = "./web/utilities/bw-pitching.csv";
     } else {
         $file = "./web/utilities/bw-pitching-test.csv";
     }
     $row = 0;
     if (($handle = fopen($file, "r")) !== FALSE) {
         while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
             if ($row) {
                 if ($data[0] >= $year) {
                     $player = utf8_encode($data[2]);
                     $slug = $this->CI->slugify->simple($player);
                     $player = $this->CI->_player->findOneBySlug($slug);
                     $team = utf8_encode($data[1]);
                     $slug = $this->CI->slugify->simple($team);
                     $team = $this->CI->_team->findOneBySlug($slug);
                     $year = $data[0];
                     if ($team) {
                         if ($player) {
                             $season = $this->CI->_season->findOneBySourceAndPlayerAndYear('Boydsworld', $player, $year);
                             $official = $this->CI->_season->findOneBySourceAndPlayerAndYear('Smallball', $player, $year);
                         }
                         if (!$season) {
                             $season = new Season();
                         }
                         $num = count($data);
                         for ($c = 0; $c < $num; $c++) {
                             $method = 'set' . ucwords($this->pitcher[$c]);
                             if (method_exists($season, $method)) {
                                 $season->{$method}($data[$c]);
                                 if ($official) {
                                     $official->{$method}($data[$c]);
                                 }
                             }
                         }
                         //print_r($season);
                         $season->setPlayer(utf8_encode($season->getPlayer()));
                         $season->setLevel('College');
                         $season->setLeague('NCAA');
                         $season->setDivision('D1');
                         /* Save Player */
                         if (!$player) {
                             $player = new Player();
                             $name = $season->getPlayer();
                             $name = explode(' ', $name);
                             if (isset($name[count($name) - 1])) {
                                 $player->setLastName(utf8_encode($name[count($name) - 1]));
                             }
                             $name = array_splice($name, 0, count($name) - 1);
                             $name = implode(' ', $name);
                             if (isset($name)) {
                                 $player->setFirstName(utf8_encode($name));
                             }
                             print_r("Adding Player: " . $team->getName() . ", " . $player->getName() . ", " . $season->getYear() . "\n");
                             $player->save();
                         } else {
                             print_r("Existing Player: " . $team->getName() . ", " . $player->getName() . ", " . $season->getYear() . "\n");
                         }
                         $season->setPlayer($player);
                         $season->setTeam($team);
                         $season->setSource('Boydsworld');
                         $season->save();
                         if (!$official) {
                             $official = clone $season;
                             $official->setSource('Smallball');
                         }
                         $official->setPlayer($player);
                         $official->setTeam($team);
                         $official->save();
                         $teamOfficial = $this->CI->_season->findOneOfficialByTeamAndYear($team, $season->getYear());
                         if ($teamOfficial) {
                             $teamOfficial->addPlayer($player);
                             $teamOfficial->save();
                         }
                     }
                     // end team
                 }
                 // end year
             }
             //row
             $row++;
         }
         fclose($handle);
     }
 }
开发者ID:bigjoevtrj,项目名称:codeigniter-bootstrap,代码行数:87,代码来源:LahmanParse.php

示例4: getSquads

 public function getSquads(Team $team)
 {
     $params = array('age' => '', 'ageComparisonType' => '', 'appearances' => '', 'appearancesComparisonType' => '', 'category' => 'summary', 'field' => 'Overall', 'includeZeroValues' => 'true', 'isCurrent' => 'true', 'isMinApp' => 'false', 'matchId' => '', 'nationality' => '', 'numberOfPlayersToPick' => '', 'page' => '', 'playerId' => '', 'positionOptions' => '', 'sotAscending' => '', 'sortBy' => 'Rating', 'stageId' => '', 'statsAccumulationType' => 0, 'subcategory' => 'all', 'teamIds' => $team->getWsId(), 'timeOfTheGameEnd' => '', 'timeOfTheGameStart' => '', 'tournamentOptions' => '');
     try {
         $data = $this->downloader->loadStatistics('player-stats', $params);
     } catch (\Exception $e) {
         throw $e;
     }
     if (empty($data->playerTableStats)) {
         throw new \Exception('No player data found');
     }
     foreach ($data->playerTableStats as $playerData) {
         $player = null;
         if (array_key_exists($playerData->playerId, $this->players)) {
             $player = $this->players[$playerData->playerId];
         } else {
             $player = $this->em->getRepository('AppBundle:Player')->findOneByWsId($playerData->playerId);
         }
         if ($player == null) {
             $player = new Player();
             $player->setFirstName($playerData->firstName);
             $player->setLastName($playerData->lastName);
             $player->setKnownName($playerData->name);
             $player->setAge($playerData->age);
             $player->setWsId($playerData->playerId);
             if ($playerData->isActive == false) {
                 $teamId = $this->downloader->getActiveTeam($playerData->playerId);
                 try {
                     $ret = $this->getTeam($teamId);
                     $player->setTeam($ret);
                 } catch (\Exception $e) {
                 }
             } else {
                 $player->setTeam($team);
             }
             $this->em->persist($player);
         }
         $this->players[$playerData->playerId] = $player;
     }
     $this->em->flush();
 }
开发者ID:johwic,项目名称:ProjectMayhem,代码行数:41,代码来源:SubscriptionManager.php


注:本文中的Player::setFirstName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。