Beispiel #1
0
 /**
  * @param \DateTimeInterface $date
  */
 public function importFromDate(\DateTimeInterface $date)
 {
     $currentDate = new \DateTimeImmutable('today');
     $interval = new \DateInterval('P1D');
     while ($currentDate >= $date) {
         $exchangeRate = $this->exchangeRateRepository->findExchangeRateByDateTime($currentDate);
         if (!$exchangeRate) {
             $exchangeRate = $this->xmlRateParser->getExchangeRateByDate($currentDate);
             $this->exchangeRateRepository->add($exchangeRate);
             $this->exchangeRateRepository->commit();
         }
         $currentDate = $currentDate->sub($interval);
     }
 }
 /**
  * @return ExchangeRateConverter
  */
 public function createActualExchangeRateConverter()
 {
     return new ExchangeRateConverter($this->exchangeRateRepository->findActualExchangeRate());
 }