MicrositeMenuItemOverrideStorageSchema.php in Entity Reference Hierarchy 3.x
File
modules/entity_hierarchy_microsite/src/MicrositeMenuItemOverrideStorageSchema.php
View source
<?php
namespace Drupal\entity_hierarchy_microsite;
use Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
class MicrositeMenuItemOverrideStorageSchema extends SqlContentEntityStorageSchema {
protected function getSharedTableFieldSchema(FieldStorageDefinitionInterface $storage_definition, $table_name, array $column_mapping) {
$schema = parent::getSharedTableFieldSchema($storage_definition, $table_name, $column_mapping);
$field_name = $storage_definition
->getName();
if ($table_name == $this->storage
->getBaseTable() && $field_name === 'target') {
$this
->addSharedTableFieldUniqueKey($storage_definition, $schema);
}
return $schema;
}
}