wsdl_docs-3.0.0-beta3/wsdl_docs.install

wsdl_docs.install
<?php

declare(strict_types = 1);

/**
 * @file
 * WSDL Docs - installation file.
 */

/**
 * Implements hook_schema().
 */
function wsdl_docs_schema(): array {
  $schema['wsdl_docs_soap_services'] = [
    'description' => 'Defines a table for storing WSDL Soap Service data during CRUD operations.',
    'fields' => [
      'nid' => [
        'type' => 'int',
        'not null' => TRUE,
        'description' => 'Node id soap service node.',
      ],
      'label' => [
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
        'description' => 'Soap service node label.',
      ],
      'url' => [
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
        'description' => 'The url of the soap service.',
      ],
      'operations' => [
        'type' => 'blob',
        'not null' => FALSE,
        'size' => 'big',
        'description' => 'The operations this web service offers.',
      ],
      'datatypes' => [
        'type' => 'blob',
        'not null' => FALSE,
        'size' => 'big',
        'description' => 'The complex data types used in the operations.',
      ],
    ],
    'primary key' => ['nid'],
  ];
  return $schema;
}

/**
 * Cleanup Soap Service and WSDL Docs node types on removal.
 */
function wsdl_docs_uninstall(): void {
  $content_type_names = [
    'wsdl_docs_operation',
    'soap_service',
  ];

  $nodeStorage = \Drupal::entityTypeManager()->getStorage('node');
  $contentTypeStorage = \Drupal::entityTypeManager()->getStorage('node_type');
  // Load all nodes and content types.
  $allNodes = $nodeStorage->loadByProperties(['type' => $content_type_names]);
  $content_types = $contentTypeStorage->loadMultiple($content_type_names);
  // Delete all WSDL Doc Operations and Soap Services on uninstall.
  try {
    if (!empty($allNodes)) {
      $nodeStorage->delete($allNodes);
    }
    // Remove content types.
    $contentTypeStorage->delete($content_types);
  }
  catch (\Exception $exception) {
    \Drupal::logger('wsdl_docs')->alert($exception->getMessage());
  }
}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc