class TermStorageSchema in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/taxonomy/src/TermStorageSchema.php \Drupal\taxonomy\TermStorageSchema
Defines the term schema handler.
Hierarchy
- class \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema implements DynamicallyFieldableEntityStorageSchemaInterface uses DependencySerializationTrait
- class \Drupal\taxonomy\TermStorageSchema
Expanded class hierarchy of TermStorageSchema
File
- core/
modules/ taxonomy/ src/ TermStorageSchema.php, line 17 - Contains \Drupal\taxonomy\TermStorageSchema.
Namespace
Drupal\taxonomyView source
class TermStorageSchema extends SqlContentEntityStorageSchema {
/**
* {@inheritdoc}
*/
protected function getEntitySchema(ContentEntityTypeInterface $entity_type, $reset = FALSE) {
$schema = parent::getEntitySchema($entity_type, $reset = FALSE);
$schema['taxonomy_term_field_data']['indexes'] += array(
'taxonomy_term__tree' => array(
'vid',
'weight',
'name',
),
'taxonomy_term__vid_name' => array(
'vid',
'name',
),
);
$schema['taxonomy_term_hierarchy'] = array(
'description' => 'Stores the hierarchical relationship between terms.',
'fields' => array(
'tid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'Primary Key: The {taxonomy_term_data}.tid of the term.',
),
'parent' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => "Primary Key: The {taxonomy_term_data}.tid of the term's parent. 0 indicates no parent.",
),
),
'indexes' => array(
'parent' => array(
'parent',
),
),
'foreign keys' => array(
'taxonomy_term_data' => array(
'table' => 'taxonomy_term_data',
'columns' => array(
'tid' => 'tid',
),
),
),
'primary key' => array(
'tid',
'parent',
),
);
$schema['taxonomy_index'] = array(
'description' => 'Maintains denormalized information about node/term relationships.',
'fields' => array(
'nid' => array(
'description' => 'The {node}.nid this record tracks.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'tid' => array(
'description' => 'The term ID.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'status' => array(
'description' => 'Boolean indicating whether the node is published (visible to non-administrators).',
'type' => 'int',
'not null' => TRUE,
'default' => 1,
),
'sticky' => array(
'description' => 'Boolean indicating whether the node is sticky.',
'type' => 'int',
'not null' => FALSE,
'default' => 0,
'size' => 'tiny',
),
'created' => array(
'description' => 'The Unix timestamp when the node was created.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'nid',
'tid',
),
'indexes' => array(
'term_node' => array(
'tid',
'status',
'sticky',
'created',
),
),
'foreign keys' => array(
'tracked_node' => array(
'table' => 'node',
'columns' => array(
'nid' => 'nid',
),
),
'term' => array(
'table' => 'taxonomy_term_data',
'columns' => array(
'tid' => 'tid',
),
),
),
);
return $schema;
}
/**
* {@inheritdoc}
*/
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 == 'taxonomy_term_field_data') {
// Remove unneeded indexes.
unset($schema['indexes']['taxonomy_term_field__vid__target_id']);
unset($schema['indexes']['taxonomy_term_field__description__format']);
switch ($field_name) {
case 'weight':
// Improves the performance of the taxonomy_term__tree index defined
// in getEntitySchema().
$schema['fields'][$field_name]['not null'] = TRUE;
break;
case 'name':
$this
->addSharedTableFieldIndex($storage_definition, $schema, TRUE);
break;
}
}
return $schema;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DependencySerializationTrait:: |
protected | property | An array of service IDs keyed by property name used for serialization. | |
DependencySerializationTrait:: |
public | function | 1 | |
DependencySerializationTrait:: |
public | function | 2 | |
SqlContentEntityStorageSchema:: |
protected | property | The database connection to be used. | |
SqlContentEntityStorageSchema:: |
protected | property | The entity manager. | |
SqlContentEntityStorageSchema:: |
protected | property | The entity type this schema builder is responsible for. | |
SqlContentEntityStorageSchema:: |
protected | property | The storage field definitions for this entity type. | |
SqlContentEntityStorageSchema:: |
protected | property | The key-value collection for tracking installed storage schema. | |
SqlContentEntityStorageSchema:: |
protected | property | The original storage field definitions for this entity type. Used during field schema updates. | |
SqlContentEntityStorageSchema:: |
protected | property | A static cache of the generated schema array. | |
SqlContentEntityStorageSchema:: |
protected | property | The storage object for the given entity type. | |
SqlContentEntityStorageSchema:: |
protected | function | Creates an index, dropping it if already existing. | |
SqlContentEntityStorageSchema:: |
protected | function | Adds a foreign key for the specified field to the given schema definition. | |
SqlContentEntityStorageSchema:: |
protected | function | Adds an index for the specified field to the given schema definition. | |
SqlContentEntityStorageSchema:: |
protected | function | Adds a unique key for the specified field to the given schema definition. | |
SqlContentEntityStorageSchema:: |
protected | function | Adds defaults to a table schema definition. | |
SqlContentEntityStorageSchema:: |
protected | function | Creates a unique key, dropping it if already existing. | |
SqlContentEntityStorageSchema:: |
protected | function | Checks that we are dealing with the correct entity type. | |
SqlContentEntityStorageSchema:: |
protected | function | Creates the schema for a field stored in a dedicated table. | |
SqlContentEntityStorageSchema:: |
protected | function | Creates the specified entity schema indexes and keys. | |
SqlContentEntityStorageSchema:: |
protected | function | Creates the schema for a field stored in a shared table. | |
SqlContentEntityStorageSchema:: |
protected | function | Deletes the schema for a field stored in a dedicated table. | |
SqlContentEntityStorageSchema:: |
protected | function | Deletes schema data for the given entity type definition. | |
SqlContentEntityStorageSchema:: |
protected | function | Deletes the specified entity schema indexes and keys. | |
SqlContentEntityStorageSchema:: |
protected | function | Deletes schema data for the given field storage definition. | |
SqlContentEntityStorageSchema:: |
protected | function | Deletes the schema for a field stored in a shared table. | |
SqlContentEntityStorageSchema:: |
public | function |
Performs final cleanup after all data of a field has been purged. Overrides DynamicallyFieldableEntityStorageSchemaInterface:: |
|
SqlContentEntityStorageSchema:: |
protected | function | Returns a list of column schema keys affecting data storage. | |
SqlContentEntityStorageSchema:: |
protected | function | Gets the SQL schema for a dedicated table. | |
SqlContentEntityStorageSchema:: |
protected | function | Gets the name to be used for the given entity index. | |
SqlContentEntityStorageSchema:: |
protected | function | Gets entity schema definitions for index and key definitions. | |
SqlContentEntityStorageSchema:: |
protected | function | Gets a list of entity type tables. | |
SqlContentEntityStorageSchema:: |
protected | function | Gets field foreign keys. | |
SqlContentEntityStorageSchema:: |
protected | function | Gets an index schema array for a given field. | |
SqlContentEntityStorageSchema:: |
protected | function | Generates an index name for a field data table. | |
SqlContentEntityStorageSchema:: |
protected | function | Gets field schema data for the given key. | |
SqlContentEntityStorageSchema:: |
protected | function | Generates a safe schema identifier (name of an index, column name etc.). | |
SqlContentEntityStorageSchema:: |
protected | function | Gets a unique key schema array for a given field. | |
SqlContentEntityStorageSchema:: |
protected | function | Gets the schema data for the given field storage definition. | |
SqlContentEntityStorageSchema:: |
protected | function | Compares schemas to check for changes in the column definitions. | |
SqlContentEntityStorageSchema:: |
protected | function | Checks whether a field property has NULL values. | |
SqlContentEntityStorageSchema:: |
protected | function | Detects whether any table name got renamed in an entity type update. | |
SqlContentEntityStorageSchema:: |
protected | function | Detects whether there is a change in the shared table structure. | |
SqlContentEntityStorageSchema:: |
protected | function | Initializes common information for a base table. | |
SqlContentEntityStorageSchema:: |
protected | function | Initializes common information for a data table. | |
SqlContentEntityStorageSchema:: |
protected | function | Initializes common information for a revision data table. | |
SqlContentEntityStorageSchema:: |
protected | function | Initializes common information for a revision table. | |
SqlContentEntityStorageSchema:: |
protected | function | Gets the keyvalue collection for tracking the installed schema. | |
SqlContentEntityStorageSchema:: |
protected | function | Checks whether a database table is non-existent or empty. | |
SqlContentEntityStorageSchema:: |
protected | function | Loads stored schema data for the given entity type definition. | |
SqlContentEntityStorageSchema:: |
protected | function | Loads stored schema data for the given field storage definition. | |
SqlContentEntityStorageSchema:: |
public | function |
Reacts to the creation of the entity type. Overrides EntityTypeListenerInterface:: |
|
SqlContentEntityStorageSchema:: |
public | function |
Reacts to the deletion of the entity type. Overrides EntityTypeListenerInterface:: |
|
SqlContentEntityStorageSchema:: |
public | function |
Reacts to the update of the entity type. Overrides EntityTypeListenerInterface:: |
|
SqlContentEntityStorageSchema:: |
public | function |
Reacts to the creation of a field storage definition. Overrides FieldStorageDefinitionListenerInterface:: |
|
SqlContentEntityStorageSchema:: |
public | function |
Reacts to the deletion of a field storage definition. Overrides FieldStorageDefinitionListenerInterface:: |
|
SqlContentEntityStorageSchema:: |
public | function |
Reacts to the update of a field storage definition. Overrides FieldStorageDefinitionListenerInterface:: |
|
SqlContentEntityStorageSchema:: |
protected | function | Performs the specified operation on a field. | |
SqlContentEntityStorageSchema:: |
protected | function | Processes the gathered schema for a base table. | |
SqlContentEntityStorageSchema:: |
protected | function | Processes the gathered schema for a base table. | |
SqlContentEntityStorageSchema:: |
protected | function | Processes the specified entity key. | 1 |
SqlContentEntityStorageSchema:: |
protected | function | Processes the gathered schema for a base table. | |
SqlContentEntityStorageSchema:: |
protected | function | Processes the gathered schema for a base table. | |
SqlContentEntityStorageSchema:: |
public | function |
Checks if existing data would be lost if the schema changes were applied. Overrides EntityStorageSchemaInterface:: |
|
SqlContentEntityStorageSchema:: |
public | function |
Checks if the changes to the entity type requires storage schema changes. Overrides EntityStorageSchemaInterface:: |
|
SqlContentEntityStorageSchema:: |
public | function |
Checks if existing data would be lost if the schema changes were applied. Overrides DynamicallyFieldableEntityStorageSchemaInterface:: |
|
SqlContentEntityStorageSchema:: |
public | function |
Checks if the changes to the storage definition requires schema changes. Overrides DynamicallyFieldableEntityStorageSchemaInterface:: |
|
SqlContentEntityStorageSchema:: |
protected | function | Stores schema data for the given entity type definition. | |
SqlContentEntityStorageSchema:: |
protected | function | Stores schema data for the given field storage definition. | |
SqlContentEntityStorageSchema:: |
protected | function | Updates the schema for a field stored in a shared table. | |
SqlContentEntityStorageSchema:: |
protected | function | Updates the schema for a field stored in a shared table. | |
SqlContentEntityStorageSchema:: |
public | function | Constructs a SqlContentEntityStorageSchema. | |
TermStorageSchema:: |
protected | function |
Gets the entity schema for the specified entity type. Overrides SqlContentEntityStorageSchema:: |
|
TermStorageSchema:: |
protected | function |
Gets the schema for a single field definition. Overrides SqlContentEntityStorageSchema:: |