diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php index 1697c16..6702553 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php @@ -39,6 +39,7 @@ public static function defaultSettings() { return array( 'target_type' => \Drupal::moduleHandler()->moduleExists('node') ? 'node' : 'user', 'target_bundle' => NULL, + 'max_length' => 255, ) + parent::defaultSettings(); } @@ -114,7 +115,7 @@ public static function schema(FieldStorageDefinitionInterface $field_definition) 'target_id' => array( 'description' => 'The ID of the target entity.', 'type' => 'varchar', - 'length' => '255', + 'length' => $field_definition->getSetting('max_length'), ), ); } diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Term.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Term.php index 510524a..8b6996a 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Term.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Term.php @@ -11,6 +11,7 @@ use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Field\FieldDefinition; +use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\Core\Language\Language; use Drupal\Core\TypedData\DataDefinition; use Drupal\taxonomy\TermInterface; @@ -164,6 +165,7 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { $fields['parent'] = FieldDefinition::create('integer') ->setLabel(t('Term Parents')) ->setDescription(t('The parents of this term.')) + ->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED) // Save new terms with no parents by default. ->setSetting('default_value', 0) ->setSetting('unsigned', TRUE) diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/TermStorage.php b/core/modules/taxonomy/lib/Drupal/taxonomy/TermStorage.php index 817e6b5..7ec905d 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/TermStorage.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/TermStorage.php @@ -158,7 +158,6 @@ public function resetWeights($vid) { public function buildSchema() { $schema = parent::buildSchema(); - $schema['taxonomy_term_data']['fields']['vid']['length'] = EntityTypeInterface::BUNDLE_MAX_LENGTH; unset($schema['taxonomy_term_data']['indexes']['field__vid']); unset($schema['taxonomy_term_data']['indexes']['field__description__format']); $schema['taxonomy_term_data']['indexes'] += array( diff --git a/core/modules/user/lib/Drupal/user/UserStorage.php b/core/modules/user/lib/Drupal/user/UserStorage.php index 7ffdeaf..c9dcc53 100644 --- a/core/modules/user/lib/Drupal/user/UserStorage.php +++ b/core/modules/user/lib/Drupal/user/UserStorage.php @@ -162,7 +162,7 @@ public function updateLastLoginTimestamp(UserInterface $account) { public function buildSchema() { $schema = parent::buildSchema(); - // The "users" table does not user serial identifiers. + // The "users" table does not use serial identifiers. $schema['users']['fields']['uid']['type'] = 'int'; $schema['users']['indexes'] += array( 'user__access' => array('access'),