add some verification on country default trigger
This commit is contained in:
@@ -13,6 +13,9 @@ class Country extends BaseCountry
|
|||||||
|
|
||||||
public function toggleDefault()
|
public function toggleDefault()
|
||||||
{
|
{
|
||||||
|
if($this->getId() === null) {
|
||||||
|
throw new \RuntimeException("impossible to just uncheck default country, choose a new one");
|
||||||
|
}
|
||||||
CountryQuery::create()
|
CountryQuery::create()
|
||||||
->filterByByDefault(1)
|
->filterByByDefault(1)
|
||||||
->update(array('ByDefault' => 0));
|
->update(array('ByDefault' => 0));
|
||||||
|
|||||||
Reference in New Issue
Block a user