Commit 0b2c622b authored by alexpott's avatar alexpott

Issue #2181593 by klausi, chakrapani, andypost: Convert entity bundle base...

Issue #2181593 by klausi, chakrapani, andypost: Convert entity bundle base fields to entity reference.
parent b7a6096b
......@@ -188,9 +188,10 @@ public static function baseFieldDefinitions($entity_type) {
->setLabel(t('Subject'))
->setDescription(t('The custom block name.'));
$fields['type'] = FieldDefinition::create('string')
$fields['type'] = FieldDefinition::create('entity_reference')
->setLabel(t('Block type'))
->setDescription(t('The block type.'));
->setDescription(t('The block type.'))
->setSetting('target_type', 'custom_block_type');
$fields['log'] = FieldDefinition::create('string')
->setLabel(t('Revision log message'))
......
......@@ -430,11 +430,10 @@ public static function baseFieldDefinitions($entity_type) {
->setLabel(t('Entity type'))
->setDescription(t('The entity type to which this comment is attached.'));
// @todo Convert to aa entity_reference field in
// https://drupal.org/node/2149859.
$fields['field_id'] = FieldDefinition::create('string')
$fields['field_id'] = FieldDefinition::create('entity_reference')
->setLabel(t('Field ID'))
->setDescription(t('The comment field id.'));
->setDescription(t('The comment field id.'))
->setSetting('target_type', 'field_entity');
$fields['field_name'] = FieldDefinition::create('string')
->setLabel(t('Comment field name'))
......
......@@ -208,11 +208,10 @@ public static function baseFieldDefinitions($entity_type) {
->setDescription(t('The term UUID.'))
->setReadOnly(TRUE);
// @todo Convert this to an entity_reference field, see
// https://drupal.org/node/2181593
$fields['vid'] = FieldDefinition::create('string')
->setLabel(t('Vocabulary ID'))
->setDescription(t('The ID of the vocabulary to which the term is assigned.'));
$fields['vid'] = FieldDefinition::create('entity_reference')
->setLabel(t('Vocabulary'))
->setDescription(t('The vocabulary to which the term is assigned.'))
->setSetting('target_type', 'taxonomy_vocabulary');
$fields['langcode'] = FieldDefinition::create('language')
->setLabel(t('Language code'))
......
......@@ -102,7 +102,7 @@ public function testTaxonomyTermReferenceItem() {
// Make sure the computed term reflects updates to the term id.
$term2 = entity_create('taxonomy_term', array(
'name' => $this->randomName(),
'vid' => $this->term->vid->value,
'vid' => $this->term->bundle(),
'langcode' => Language::LANGCODE_NOT_SPECIFIED,
));
$term2->save();
......
......@@ -41,6 +41,10 @@ public function setUp() {
* Tests the term validation constraints.
*/
public function testValidation() {
$this->entityManager->getStorageController('taxonomy_vocabulary')->create(array(
'vid' => 'tags',
'name' => 'Tags',
))->save();
$term = $this->entityManager->getStorageController('taxonomy_term')->create(array(
'name' => 'test',
'vid' => 'tags',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment