public function run($request) { $zone = new Zone(); $zone->Name = "International"; $zone->Description = "All countries"; $zone->write(); $countries = ShopConfig::current()->getCountriesList(); foreach ($countries as $code => $country) { $zoneregion = new ZoneRegion(array('ZoneID' => $zone->ID, 'Country' => $code)); $zoneregion->write(); echo "."; } }
public function populateInternationalZone() { $zone = new Zone(array('Name' => 'International')); $zone->write(); if ($countries = SiteConfig::current_site_config()->getCountriesList()) { foreach ($countries as $iso => $country) { $region = new ZoneRegion(array('Country' => $iso, 'ZoneID' => $zone->ID)); $region->write(); } } }