add some verification on country default trigger

This commit is contained in:
Manuel Raynaud
2013-10-21 12:08:19 +02:00
parent 9ca612ae0d
commit 0ba6a599a9

View File

@@ -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));