当前位置: 首页>>代码示例>>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;未经允许,请勿转载。