ispim-1.0.x-dev/src/PreviewImage/StorageSchema.php

src/PreviewImage/StorageSchema.php
<?php

declare(strict_types=1);

namespace Drupal\ispim\PreviewImage;

use Drupal\Core\Entity\ContentEntityTypeInterface;
use Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema;

class StorageSchema extends SqlContentEntityStorageSchema {

  /**
   * {@inheritdoc}
   *
   * @phpstan-return array<string, mixed>
   */
  protected function getEntitySchema(
    ContentEntityTypeInterface $entity_type,
    $reset = FALSE,
  ): array {
    $schema = parent::getEntitySchema($entity_type, $reset);

    $keys = $entity_type->getKeys();
    $dataTableName = $this->storage->getDataTable();
    if ($dataTableName) {
      $schema[$dataTableName]['indexes'] += [
        "{$dataTableName}__weight" => [
          $keys['weight'],
          $keys['label'],
        ],
      ];
    }

    return $schema;
  }

}

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

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