當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Team::setNickname方法代碼示例

本文整理匯總了PHP中Team::setNickname方法的典型用法代碼示例。如果您正苦於以下問題:PHP Team::setNickname方法的具體用法?PHP Team::setNickname怎麽用?PHP Team::setNickname使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Team的用法示例。


在下文中一共展示了Team::setNickname方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: importSchools

 public function importSchools($real = false, $year = 0)
 {
     if ($real) {
         $file = "./web/utilities/lahman/Schools.csv";
     } else {
         $file = "./web/utilities/lahman/Schools-test.csv";
     }
     $row = 0;
     if (($handle = fopen($file, "r")) !== FALSE) {
         while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
             if ($row) {
                 $team = $this->CI->_team->findOneByOfficialName(utf8_encode($data[1]));
                 if (!$team) {
                     $team = $this->CI->_team->findOneByLahmanId(utf8_encode($data[0]));
                 }
                 if (!$team) {
                     $team = new Team();
                     $team->setOfficialName(utf8_encode($data[1]));
                     $team->setLahmanId(utf8_encode($data[0]));
                     $team->setNickname($data[4]);
                     $team->setCity($data[2]);
                     $team->setState($data[3]);
                 }
                 print_r($team);
             }
             //row
             $row++;
         }
         fclose($handle);
     }
 }
開發者ID:bigjoevtrj,項目名稱:codeigniter-bootstrap,代碼行數:31,代碼來源:LahmanParse.php

示例2: getOrCreateTeam

 protected function getOrCreateTeam($name, $nickname)
 {
     $nickname = trim($nickname);
     $name = trim(str_replace($nickname, '', $name));
     $slug = $this->CI->slugify->simple($name);
     $team = $this->CI->_team->findOneBySlug($slug);
     if (!$team) {
         $team = new Team();
         $team->setName($name);
         $team->setNickname($nickname);
         $team->save();
     }
     return $team;
 }
開發者ID:bigjoevtrj,項目名稱:codeigniter-bootstrap,代碼行數:14,代碼來源:PointstreakParse.php

示例3: load

 public function load()
 {
     $this->clear();
     // Miami Hurricanes
     $team = new Team('Miami, FL');
     $team->setOfficialName('University of Miami');
     $team->setNickname('Hurricanes');
     $team->setCity('Miami');
     $team->setState('FL');
     $team->setNcaaId(415);
     $level = $this->CI->_level->findOneBySlug('college');
     $team->setLevel($level);
     $league = $this->CI->_league->findOneBySlug('ncaa');
     $team->setLeague($league);
     $division = $this->CI->_division->findOneBySlug('d1');
     $team->setDivision($division);
     $conference = $this->CI->_conference->findOneBySlug('atlantic-coast');
     $team->setConference($conference);
     $team->save();
     print_r(sprintf("Created Team: %s (%s)\n", $team->getName(), $team->getId()));
     // Maryland Terrapins
     $team = new Team('Maryland');
     $team->setOfficialName('University of Maryland');
     $team->setNickname('Terrapins');
     $team->setCity('College Park');
     $team->setState('FL');
     $team->setNcaaId(392);
     $level = $this->CI->_level->findOneBySlug('college');
     $team->setLevel($level);
     $league = $this->CI->_league->findOneBySlug('ncaa');
     $team->setLeague($league);
     $division = $this->CI->_division->findOneBySlug('d1');
     $team->setDivision($division);
     $conference = $this->CI->_conference->findOneBySlug('atlantic-coast');
     $team->setConference($conference);
     $team->save();
     print_r(sprintf("Created Team: %s (%s)\n", $team->getName(), $team->getId()));
 }
開發者ID:bigjoevtrj,項目名稱:codeigniter-bootstrap,代碼行數:38,代碼來源:team.php

示例4: saveTeamsForConference

 public function saveTeamsForConference($teams, $conference)
 {
     $documents = array();
     foreach ($teams as $team) {
         $slug = $this->slugify->simple($team['name']);
         $document = $this->findOneBySlug($slug);
         if (!$document) {
             $document = new Team();
             $document->setSlug($slug);
             $document->setName($team['name']);
             $document->setNickname($team['nickname']);
             $document->setConference($conference);
             $document->save();
         }
         $documents[] = $document;
     }
     return $documents;
 }
開發者ID:bigjoevtrj,項目名稱:codeigniter-bootstrap,代碼行數:18,代碼來源:teamrepository.php


注:本文中的Team::setNickname方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。