From a8f404421f3e404ccd285da861a8cb25f3642f31 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Thu, 14 Jan 2016 20:40:31 -0500 Subject: Fix bug: unable to set currency rate with Postgres --- app/Model/Currency.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/Model') diff --git a/app/Model/Currency.php b/app/Model/Currency.php index 316a0141..4351d2aa 100644 --- a/app/Model/Currency.php +++ b/app/Model/Currency.php @@ -42,7 +42,7 @@ class Currency extends Base $reference = $this->config->get('application_currency', 'USD'); if ($reference !== $currency) { - $rates = $rates === null ? $this->db->hashtable(self::TABLE)->getAll('currency', 'rate') : array(); + $rates = $rates === null ? $this->db->hashtable(self::TABLE)->getAll('currency', 'rate') : $rates; $rate = isset($rates[$currency]) ? $rates[$currency] : 1; return $rate * $price; @@ -65,7 +65,7 @@ class Currency extends Base return $this->update($currency, $rate); } - return $this->persist(self::TABLE, compact('currency', 'rate')); + return $this->db->table(self::TABLE)->insert(array('currency' => $currency, 'rate' => $rate)); } /** -- cgit v1.2.3