Skip to content

Commit

Permalink
GlobalConfigMigration - add fields for CompanyConfig (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsirish authored Dec 24, 2018
1 parent 8c93cdd commit d37ee8b
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions src/Migration/GlobalConfigMigration.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,18 @@
namespace Dynamic\CoreTools\Migration;

use Dynamic\CompanyConfig\Model\CompanyConfigSetting;
use Dynamic\TemplateConfig\Model\NavigationColumn;
use Dynamic\TemplateConfig\Model\TemplateConfigSetting;
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Dev\Debug;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\GridField\GridField;
use SilverStripe\Forms\GridField\GridFieldAddExistingAutocompleter;
use SilverStripe\Forms\GridField\GridFieldAddNewButton;
use SilverStripe\Forms\GridField\GridFieldConfig_RelationEditor;
use SilverStripe\Forms\GridField\GridFieldEditButton;
use SilverStripe\Forms\HeaderField;
use SilverStripe\Forms\LiteralField;
use SilverStripe\ORM\DataExtension;
use Symbiote\Addressable\Addressable;
use Symbiote\Addressable\Geocodable;
use Symbiote\GridFieldExtensions\GridFieldAddExistingSearchButton;
use Symbiote\GridFieldExtensions\GridFieldOrderableRows;

class GlobalConfigMigration extends DataExtension
{
/**
* @var array
*/
private static $db = array(
'CompanyName' => 'Varchar(200)',
);

/**
* @var array
*/
Expand All @@ -45,9 +37,12 @@ class GlobalConfigMigration extends DataExtension
public function onAfterWrite()
{
parent::onAfterWrite();

$company = CompanyConfigSetting::current_company_config();
$company->CompanyName = $this->owner->CompanyName;
$company->write();

$template = TemplateConfigSetting::current_template_config();

foreach ($this->owner->UtilityLinks() as $link) {
$template->UtilityLinks()->add($link);
}
Expand Down

0 comments on commit d37ee8b

Please sign in to comment.