getDedicatedTableSchema example


  protected function getSchemaFromStorageDefinition(FieldStorageDefinitionInterface $storage_definition) {
    assert(!$storage_definition->hasCustomStorage());
    $table_mapping = $this->getTableMapping($this->entityType, [$storage_definition]);
    $schema = [];
    if ($table_mapping->requiresDedicatedTableStorage($storage_definition)) {
      $schema = $this->getDedicatedTableSchema($storage_definition);
    }
    elseif ($table_mapping->allowsSharedTableStorage($storage_definition)) {
      $field_name = $storage_definition->getName();
      foreach (array_diff($table_mapping->getTableNames()$table_mapping->getDedicatedTableNames()) as $table_name) {
        if (in_array($field_name$table_mapping->getFieldNames($table_name))) {
          $column_names = $table_mapping->getColumnNames($storage_definition->getName());
          $schema[$table_name] = $this->getSharedTableFieldSchema($storage_definition$table_name$column_names);
        }
      }
    }
    return $schema;
  }
break;
      }
    }

    return $schema;
  }

  /** * {@inheritdoc} */
  protected function getDedicatedTableSchema(FieldStorageDefinitionInterface $storage_definition, ContentEntityTypeInterface $entity_type = NULL) {
    $dedicated_table_schema = parent::getDedicatedTableSchema($storage_definition$entity_type);

    // Add an index on 'bundle', 'delta' and 'parent_target_id' columns to     // increase the performance of the query from     // \Drupal\taxonomy\TermStorage::getVocabularyHierarchyType().     if ($storage_definition->getName() === 'parent') {
      /** @var \Drupal\Core\Entity\Sql\DefaultTableMapping $table_mapping */
      $table_mapping = $this->storage->getTableMapping();
      $dedicated_table_name = $table_mapping->getDedicatedDataTableName($storage_definition);

      unset($dedicated_table_schema[$dedicated_table_name]['indexes']['bundle']);
      $dedicated_table_schema[$dedicated_table_name]['indexes']['bundle_delta_target_id'] = [
        
Home | Imprint | This part of the site doesn't use cookies.