/** * @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; }
/** * @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); } }
/** * @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; }