コード例 #1
0
ファイル: Transfer.php プロジェクト: kosak83/OpenSoccerStar
 /**
  * @param TransferOffer $transferOffer
  * @param GameDate $gameDate
  *
  * @return Transfer
  */
 public static function createFromOffer(TransferOffer $transferOffer, GameDate $gameDate)
 {
     $transfer = new Transfer();
     $transfer->setOriginTeam($transferOffer->getOriginTeam());
     $transfer->setTargetTeam($transferOffer->getTargetTeam());
     $transfer->setPlayer($transferOffer->getPlayer());
     $transfer->setAmount($transferOffer->getAmount());
     $transfer->setSeason($gameDate->getSeason());
     return $transfer;
 }
コード例 #2
0
 /**
  * @param TransferOffer $transferOffer
  * @param GameDate $gameDate
  */
 private function decideOnTransferOffer(TransferOffer $transferOffer, GameDate $gameDate)
 {
     if ($transferOffer->isSellAccepted()) {
         $transfer = $transferOffer->execute($gameDate);
         $this->entityManager->persist($transfer);
         $this->entityManager->remove($transferOffer);
     } elseif ($transferOffer->isSellDenied()) {
         $this->entityManager->remove($transferOffer);
     }
 }
コード例 #3
0
ファイル: Manager.php プロジェクト: kosak83/OpenSoccerStar
 /**
  * @param Player $player
  *
  * @return TransferOffer
  */
 public function createTransferOffer(Player $player)
 {
     $transfer = new TransferOffer();
     $transfer->setPlayer($player);
     $transfer->setOriginTeam($player->getTeam());
     $transfer->setTargetTeam($this->team);
     $transfer->setAmount($player->getMarketValue());
     return $transfer;
 }