l10n_server-2.x-dev/l10n_server/src/Entity/Storage/L10nServerFileStorageSchema.php

l10n_server/src/Entity/Storage/L10nServerFileStorageSchema.php
<?php

declare(strict_types=1);

namespace Drupal\l10n_server\Entity\Storage;

use Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema;
use Drupal\Core\Field\FieldStorageDefinitionInterface;

/**
 * Storage schema class.
 */
class L10nServerFileStorageSchema extends SqlContentEntityStorageSchema {

  /**
   * {@inheritdoc}
   */
  protected function getSharedTableFieldSchema(FieldStorageDefinitionInterface $storage_definition, $table_name, array $column_mapping): array {
    $schema = parent::getSharedTableFieldSchema($storage_definition, $table_name, $column_mapping);
    $field_name = $storage_definition->getName();

    if ($table_name === 'l10n_server_file') {
      switch ($field_name) {
        case 'location':
        case 'revision':
          $schema['fields'][$field_name]['not null'] = TRUE;
          break;
      }
      if ($field_name === 'rid') {
        $this->addSharedTableFieldIndex($storage_definition, $schema, TRUE);
      }
      elseif ($field_name === 'pid') {
        $this->addSharedTableFieldIndex($storage_definition, $schema, TRUE);
      }
    }
    return $schema;
  }

}

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

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