addDependency('config'); } protected function getConfig() { return $this->getInjection('config'); } protected function afterSave(Entity $entity, array $options) { parent::afterSave($entity, $options); if ($entity->has('isDefault')) { if ($entity->get('isDefault')) { $this->getConfig()->set('defaultPortalId', $entity->id); } else { $this->getConfig()->set('defaultPortalId', null); } $this->getConfig()->save(); } } }