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


PHP Agent::mapper方法代码示例

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


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

示例1: create_object

 public function create_object($data)
 {
     $data = \Core\Dict::create($data);
     $assassin = Agent::mapper()->create_object(array('id' => $data->assassin, 'alias' => $data->assassin_agent_alias));
     $target = Agent::mapper()->create_object(array('id' => $data->target, 'alias' => $data->target_agent_alias));
     $weapon = Weapon::mapper()->create_object(array('id' => $data->weapon_id, 'name' => $data->weapon_name));
     return Kill::create(array('id' => $data->id, 'description' => $data->description, 'assassin' => $assassin, 'target' => $target, 'weapon' => $weapon, 'game' => $game, 'when_happened' => new \DateTime($data->when_happened)), True);
 }
开发者ID:radiosilence,项目名称:trouble,代码行数:8,代码来源:kill.php

示例2: create_object

 public function create_object($data)
 {
     if (empty($data['victor'])) {
         $data['victor'] = 0;
     } else {
         $data['victor'] = Agent::mapper()->create_object(array('id' => $data['victor'], 'alias' => $data['victor_agent_alias']));
         unset($data['victor_alias']);
     }
     $game = Game::create($data, True);
     $game->attach_mapper('Kill', Kill::mapper()->attach_storage(\Core\Storage::container()->get_storage('Kill')));
     $game->attach_mapper('Agent', Agent::mapper()->attach_storage(\Core\Storage::container()->get_storage('Agent')));
     foreach (array('start_date', 'end_date') as $f) {
         $game[$f] = new \DateTime($game[$f]);
     }
     $game->invite_only = (int) $data['invite_only'];
     $now = new \DateTime();
     if ($game->start_date > $now) {
         $game['joinable'] = True;
         $game['active'] = False;
         $game['state'] = 0;
     } else {
         if ($game->start_date < $now && $now < $game->end_date) {
             $game['joinable'] = False;
             $game['active'] = True;
             $game['state'] = 1;
         } else {
             $game['joinable'] = False;
             $game['active'] = False;
             $game['state'] = 2;
         }
     }
     return $game;
 }
开发者ID:radiosilence,项目名称:trouble,代码行数:33,代码来源:game.php

示例3: create_object

 public function create_object($data)
 {
     $agent = Agent::mapper()->create_object(array('id' => $data['agent'], 'alias' => $data['agent_alias'], 'avatar' => $data['agent_avatar']));
     return Player::create(array('id' => $data['id'], 'agent' => $agent, 'target' => $data['target'], 'credits' => $data['credits'], 'pkn' => $data['pkn'], 'status' => $data['status']));
 }
开发者ID:radiosilence,项目名称:trouble,代码行数:5,代码来源:player.php


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