Skip to content

Commit 30b5a0f

Browse files
[#109] Add back deprecated apidoc table to avoid update issues. (#110)
1 parent fc12afb commit 30b5a0f

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed

apigee_api_catalog.install

+10-2
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,16 @@ function apigee_api_catalog_update_8804(&$sandbox) {
115115
}
116116

117117
/**
118-
* Delete API Doc entity definition if updating from 1.x.
118+
* Deprecated step.
119119
*/
120120
function apigee_api_catalog_update_8805() {
121-
return \Drupal::service('apigee_api_catalog.updates')->update8805();
121+
// return \Drupal::service('apigee_api_catalog.updates')->update8805();
122122
}
123+
124+
/**
125+
* Re-install if needed deprecated API Doc entity definition.
126+
*/
127+
function apigee_api_catalog_update_8806() {
128+
return \Drupal::service('apigee_api_catalog.updates')->update8806();
129+
}
130+

src/Entity/Access/ApiDocAccessControlHandler.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
/**
3434
* Access controller for the API Doc entity.
35-
*
35+
*
3636
* @deprecated in 2.x and is removed from 3.x. Use the node "apidoc" bundle instead.
3737
* @see https://github.com/apigee/apigee-api-catalog-drupal/pull/84
3838
*

src/UpdateService.php

+17-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public function update8802() {
175175
}
176176

177177
/**
178-
* Recreate other fields added to the API Doc entity onto the API Doc node type.
178+
* Recreate other fields added to API Doc entity onto the API Doc node type.
179179
*
180180
* @return string
181181
* A message to display.
@@ -316,6 +316,22 @@ public function update8805() {
316316
return 'The API Doc deprecated entity type has been removed from the system.';
317317
}
318318

319+
/**
320+
* Recreate API Doc entity definition.
321+
*
322+
* Rollback update8805().
323+
*/
324+
public function update8806() {
325+
\Drupal::entityTypeManager()->clearCachedDefinitions();
326+
$entity_definition_update_manager = \Drupal::entityDefinitionUpdateManager();
327+
$entity_definition_update_manager->installEntityType(\Drupal::entityTypeManager()->getDefinition('apidoc'));
328+
329+
// Clear all caches.
330+
drupal_flush_all_caches();
331+
332+
return 'Installed API Doc deprecated entity type.';
333+
}
334+
319335
/**
320336
* Get the field map from apidoc fields to node fields.
321337
*

0 commit comments

Comments
 (0)