/** * Build default list of billing countries * * @see Country::$iso_3166_countryCodes * @see DataObject::requireDefaultRecords() */ public function requireDefaultRecords() { parent::requireDefaultRecords(); if (!DataObject::get_one('Country_Billing')) { foreach (self::$iso_3166_countryCodes as $code => $title) { $country = new Country_Billing(); $country->Code = $code; $country->Title = $title; $country->write(); } DB::alteration_message('Billing countries created', 'created'); } }
/** * Build default list of billing countries * * @see Country::$iso_3166_countryCodes * @see DataObject::requireDefaultRecords() */ public function requireDefaultRecords() { parent::requireDefaultRecords(); if (!DataObject::get_one('Country_Billing')) { $shopConfig = ShopConfig::current_shop_config(); if (isset($shopConfig->ID)) { foreach (self::$iso_3166_countryCodes as $code => $title) { $country = new Country_Billing(); $country->Code = $code; $country->Title = $title; $country->ShopConfigID = $shopConfig->ID; $country->write(); } DB::alteration_message('Billing countries created', 'created'); } else { DB::alteration_message('Billing countries not created, please re-run /dev/build', 'error'); } } }