From 0ba6a599a9821523c36ec2adafdba53cc54f2209 Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Mon, 21 Oct 2013 12:08:19 +0200 Subject: [PATCH] add some verification on country default trigger --- core/lib/Thelia/Model/Country.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/lib/Thelia/Model/Country.php b/core/lib/Thelia/Model/Country.php index 13d706839..e64bd4609 100755 --- a/core/lib/Thelia/Model/Country.php +++ b/core/lib/Thelia/Model/Country.php @@ -13,6 +13,9 @@ class Country extends BaseCountry public function toggleDefault() { + if($this->getId() === null) { + throw new \RuntimeException("impossible to just uncheck default country, choose a new one"); + } CountryQuery::create() ->filterByByDefault(1) ->update(array('ByDefault' => 0));