diff --git a/apigee_edge.install b/apigee_edge.install index 3a95a095..e0837b59 100644 --- a/apigee_edge.install +++ b/apigee_edge.install @@ -24,6 +24,7 @@ use Drupal\apigee_edge\OauthTokenFileStorage; use Drupal\apigee_edge\Plugin\EdgeKeyTypeInterface; +use Drupal\Core\Field\BaseFieldDefinition; use Drupal\Core\Installer\InstallerKernel; use Drupal\Core\Url; use Drupal\user\RoleInterface; @@ -349,3 +350,26 @@ function apigee_edge_update_8107() { $storage->removeTokenFile(); } } + +/** + * Update the field storage defination of Developer App. + */ +function apigee_edge_update_9001() { + $definition_update_manager = \Drupal::entityDefinitionUpdateManager(); + /** @var \Drupal\Core\Entity\EntityLastInstalledSchemaRepositoryInterface $last_installed_schema_repository */ + $last_installed_schema_repository = \Drupal::service('entity.last_installed_schema.repository'); + $entity_type_id = 'developer_app'; + $entity_type = $definition_update_manager->getEntityType($entity_type_id); + $field_storage_definitions = $last_installed_schema_repository->getLastInstalledFieldStorageDefinitions($entity_type_id); + + $field_storage_definitions['apiProducts'] = BaseFieldDefinition::create('string') + ->setName('apiproducts') + ->setTargetEntityTypeId($entity_type_id) + ->setTargetBundle(NULL) + ->setStorageRequired(FALSE) + ->setInternal(TRUE) + ->setTranslatable(FALSE) + ->setRevisionable(FALSE); + + $definition_update_manager->updateFieldableEntityType($entity_type, $field_storage_definitions); +} diff --git a/modules/apigee_edge_teams/apigee_edge_teams.install b/modules/apigee_edge_teams/apigee_edge_teams.install index 24ee197b..4e73e9d1 100644 --- a/modules/apigee_edge_teams/apigee_edge_teams.install +++ b/modules/apigee_edge_teams/apigee_edge_teams.install @@ -20,6 +20,7 @@ use Apigee\Edge\Utility\OrganizationFeatures; use Drupal\Core\Config\FileStorage; +use Drupal\Core\Field\BaseFieldDefinition; use Drupal\user\RoleInterface; use Drupal\views\Views; @@ -177,4 +178,25 @@ function apigee_edge_teams_update_8705() { } } - +/** + * Update the field storage defination of Team App. + */ +function apigee_edge_teams_update_9001() { + $definition_update_manager = \Drupal::entityDefinitionUpdateManager(); + /** @var \Drupal\Core\Entity\EntityLastInstalledSchemaRepositoryInterface $last_installed_schema_repository */ + $last_installed_schema_repository = \Drupal::service('entity.last_installed_schema.repository'); + $entity_type_id = 'team_app'; + $entity_type = $definition_update_manager->getEntityType($entity_type_id); + $field_storage_definitions = $last_installed_schema_repository->getLastInstalledFieldStorageDefinitions($entity_type_id); + + $field_storage_definitions['apiProducts'] = BaseFieldDefinition::create('string') + ->setName('apiproducts') + ->setTargetEntityTypeId($entity_type_id) + ->setTargetBundle(NULL) + ->setStorageRequired(FALSE) + ->setInternal(TRUE) + ->setTranslatable(FALSE) + ->setRevisionable(FALSE); + + $definition_update_manager->updateFieldableEntityType($entity_type, $field_storage_definitions); +} diff --git a/src/Entity/App.php b/src/Entity/App.php index 625f18e4..60c5898a 100644 --- a/src/Entity/App.php +++ b/src/Entity/App.php @@ -341,6 +341,7 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { // Hide readonly properties from Manage form display list. $read_only_fields = [ + 'apiProducts', 'appId', 'appFamily', 'createdAt',