Skip to content

Commit 56f012c

Browse files
authored
Update the storage defination of App entity (#831)
1 parent acc1c18 commit 56f012c

File tree

3 files changed

+48
-1
lines changed

3 files changed

+48
-1
lines changed

apigee_edge.install

+24
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
use Drupal\apigee_edge\OauthTokenFileStorage;
2626
use Drupal\apigee_edge\Plugin\EdgeKeyTypeInterface;
27+
use Drupal\Core\Field\BaseFieldDefinition;
2728
use Drupal\Core\Installer\InstallerKernel;
2829
use Drupal\Core\Url;
2930
use Drupal\user\RoleInterface;
@@ -349,3 +350,26 @@ function apigee_edge_update_8107() {
349350
$storage->removeTokenFile();
350351
}
351352
}
353+
354+
/**
355+
* Update the field storage defination of Developer App.
356+
*/
357+
function apigee_edge_update_9001() {
358+
$definition_update_manager = \Drupal::entityDefinitionUpdateManager();
359+
/** @var \Drupal\Core\Entity\EntityLastInstalledSchemaRepositoryInterface $last_installed_schema_repository */
360+
$last_installed_schema_repository = \Drupal::service('entity.last_installed_schema.repository');
361+
$entity_type_id = 'developer_app';
362+
$entity_type = $definition_update_manager->getEntityType($entity_type_id);
363+
$field_storage_definitions = $last_installed_schema_repository->getLastInstalledFieldStorageDefinitions($entity_type_id);
364+
365+
$field_storage_definitions['apiProducts'] = BaseFieldDefinition::create('string')
366+
->setName('apiproducts')
367+
->setTargetEntityTypeId($entity_type_id)
368+
->setTargetBundle(NULL)
369+
->setStorageRequired(FALSE)
370+
->setInternal(TRUE)
371+
->setTranslatable(FALSE)
372+
->setRevisionable(FALSE);
373+
374+
$definition_update_manager->updateFieldableEntityType($entity_type, $field_storage_definitions);
375+
}

modules/apigee_edge_teams/apigee_edge_teams.install

+23-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
use Apigee\Edge\Utility\OrganizationFeatures;
2222
use Drupal\Core\Config\FileStorage;
23+
use Drupal\Core\Field\BaseFieldDefinition;
2324
use Drupal\user\RoleInterface;
2425
use Drupal\views\Views;
2526

@@ -177,4 +178,25 @@ function apigee_edge_teams_update_8705() {
177178
}
178179
}
179180

180-
181+
/**
182+
* Update the field storage defination of Team App.
183+
*/
184+
function apigee_edge_teams_update_9001() {
185+
$definition_update_manager = \Drupal::entityDefinitionUpdateManager();
186+
/** @var \Drupal\Core\Entity\EntityLastInstalledSchemaRepositoryInterface $last_installed_schema_repository */
187+
$last_installed_schema_repository = \Drupal::service('entity.last_installed_schema.repository');
188+
$entity_type_id = 'team_app';
189+
$entity_type = $definition_update_manager->getEntityType($entity_type_id);
190+
$field_storage_definitions = $last_installed_schema_repository->getLastInstalledFieldStorageDefinitions($entity_type_id);
191+
192+
$field_storage_definitions['apiProducts'] = BaseFieldDefinition::create('string')
193+
->setName('apiproducts')
194+
->setTargetEntityTypeId($entity_type_id)
195+
->setTargetBundle(NULL)
196+
->setStorageRequired(FALSE)
197+
->setInternal(TRUE)
198+
->setTranslatable(FALSE)
199+
->setRevisionable(FALSE);
200+
201+
$definition_update_manager->updateFieldableEntityType($entity_type, $field_storage_definitions);
202+
}

src/Entity/App.php

+1
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
341341

342342
// Hide readonly properties from Manage form display list.
343343
$read_only_fields = [
344+
'apiProducts',
344345
'appId',
345346
'appFamily',
346347
'createdAt',

0 commit comments

Comments
 (0)