protected function SqlContentEntityStorageSchema::addSharedTableFieldForeignKey in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::addSharedTableFieldForeignKey()
- 9 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.
2 calls to SqlContentEntityStorageSchema::addSharedTableFieldForeignKey()
- CommentStorageSchema::getSharedTableFieldSchema in core/
modules/ comment/ src/ CommentStorageSchema.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 2206
Class
- SqlContentEntityStorageSchema
- Defines a schema handler that supports revisionable, translatable entities.
Namespace
Drupal\Core\Entity\SqlCode
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] = [
'table' => $foreign_table,
'columns' => [
$name => $foreign_column,
],
];
}