Issue #2181593 by klausi, chakrapani, andypost: Convert entity bundle base fields to entity reference.
parent
b7a6096b21
commit
0b2c622bfa
|
@ -188,9 +188,10 @@ class CustomBlock extends ContentEntityBase implements CustomBlockInterface {
|
|||
->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 @@ class Comment extends ContentEntityBase implements CommentInterface {
|
|||
->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 @@ class Term extends ContentEntityBase implements TermInterface {
|
|||
->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 @@ class TaxonomyTermReferenceItemTest extends FieldUnitTestBase {
|
|||
// 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 @@ class TermValidationTest extends EntityUnitTestBase {
|
|||
* 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',
|
||||
|
|
Loading…
Reference in New Issue