示例#1
0
 public function __construct($player)
 {
     parent::__construct($player);
     $userRepository = new UserRepository();
     $user = $userRepository->getOneById($player['user']);
     $this->setAdditionalField('user', $user);
     $roleRepository = new RoleRepository(TRUE);
     $role = $roleRepository->getOneById($player['role']);
     $this->setAdditionalField('role', $role);
     $characterRepository = new CharacterRepository(TRUE);
     $character = $characterRepository->getOneById($player['charakter']);
     $this->setAdditionalField('character', $character);
     $cardRepository = new CardRepository(TRUE);
     $handCardsId = unserialize($player['hand_cards']);
     $handCards = array();
     if ($handCardsId) {
         $cardRepository->addOrderBy(array('card_base_type' => 'ASC'));
         $handCards = $cardRepository->getById($handCardsId);
     }
     $this->setAdditionalField('hand_cards', $handCards);
     $cardRepository = new CardRepository(TRUE);
     $tableCardsId = unserialize($player['table_cards']);
     $tableCards = array();
     if ($tableCardsId) {
         $cardRepository->addOrderBy(array('card_base_type' => 'ASC'));
         $tableCards = $cardRepository->getById($tableCardsId);
     }
     $this->setAdditionalField('table_cards', $tableCards);
     $waitCardsId = unserialize($player['wait_cards']);
     $waitCards = array();
     if ($waitCardsId) {
         $cardRepository->addOrderBy(array('card_base_type' => 'ASC'));
         $waitCards = $cardRepository->getById($waitCardsId);
     }
     $this->setAdditionalField('wait_cards', $waitCards);
     if ($player['notices']) {
         $notices = unserialize($player['notices']);
     } else {
         $notices = array();
     }
     $this->setAdditionalField('notice_list', $notices);
 }