protected TermStorageSchema::getEntitySchema(ContentEntityTypeInterface $entity_type, $reset = FALSE)
Gets the entity schema for the specified entity type.
Entity types may override this method in order to optimize the generated schema of the entity tables. However, only cross-field optimizations should be added here; e.g., an index spanning multiple fields. Optimizations that apply to a single field have to be added via SqlContentEntityStorageSchema::getSharedTableFieldSchema() instead.
Parameters
\Drupal\Core\Entity\ContentEntityTypeInterface $entity_type: The entity type definition.
bool $reset: (optional) If set to TRUE static cache will be ignored and a new schema array generation will be performed. Defaults to FALSE.
Return value
array A Schema API array describing the entity schema, excluding dedicated field tables.
Throws
\Drupal\Core\Field\FieldException
Overrides SqlContentEntityStorageSchema::getEntitySchema
File
- core/modules/taxonomy/src/TermStorageSchema.php, line 17
Class
- TermStorageSchema
- Defines the term schema handler.
Namespace
Drupal\taxonomy
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | 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 ; } |
Please login to continue.