You are here

protected function SqlContentEntityStorageSchema::addSharedTableFieldForeignKey in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::addSharedTableFieldForeignKey()

Adds a foreign key for the specified field to the given schema definition.

Parameters

\Drupal\Core\Field\FieldStorageDefinitionInterface $storage_definition: The storage definition of the field to which to add a foreign key.

array $schema: A reference to the schema array to be updated.

string $foreign_table: The foreign table.

string $foreign_column: The foreign column.

3 calls to SqlContentEntityStorageSchema::addSharedTableFieldForeignKey()
CommentStorageSchema::getSharedTableFieldSchema in core/modules/comment/src/CommentStorageSchema.php
Gets the schema for a single field definition.
ItemStorageSchema::getSharedTableFieldSchema in core/modules/aggregator/src/ItemStorageSchema.php
Gets the schema for a single field definition.
NodeStorageSchema::getSharedTableFieldSchema in core/modules/node/src/NodeStorageSchema.php
Gets the schema for a single field definition.

File

core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php, line 1695
Contains \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema.

Class

SqlContentEntityStorageSchema
Defines a schema handler that supports revisionable, translatable entities.

Namespace

Drupal\Core\Entity\Sql

Code

protected function addSharedTableFieldForeignKey(FieldStorageDefinitionInterface $storage_definition, &$schema, $foreign_table, $foreign_column) {
  $name = $storage_definition
    ->getName();
  $real_key = $this
    ->getFieldSchemaIdentifierName($storage_definition
    ->getTargetEntityTypeId(), $name);
  $schema['foreign keys'][$real_key] = array(
    'table' => $foreign_table,
    'columns' => array(
      $name => $foreign_column,
    ),
  );
}