/** * {@inheritdoc} */ public function up() { // only run this task if there aren't any time zones defined yet if (TimeZoneData::get()->count() == 0) { $this->message('Adding new time zone entries.'); // prepare the information provided by PHP $timezones = DateTimeZone::listIdentifiers(); foreach ($timezones as $timezone) { // replace some strings to increase the readibility. $tzNice = str_replace(array_keys($this->replacementMap), array_values($this->replacementMap), $timezone); // split the time zone information into the sections $timezoneParts = explode('/', $tzNice); // adding the new time zone $tz = new TimeZoneData(); $tz->Identifier = $timezone; $tz->Region = $timezoneParts[0]; $tz->Name = array_pop($timezoneParts); $tz->write(); } $this->message('Finished adding new time zone entries.'); } // check if the titles in the dataobjects need to be refreshed if ($this->checkIfTitlesNeedRebuild()) { $this->rebuildTitles(); } }