0

I have updated my site to drupal 8.4. Has installFieldStorageDefinition() changed in 8.4? Previously code such as below successfully added an entity reference field to my custom entity database table.

  $storage_definition = BaseFieldDefinition::create('entity_reference')
    ->setLabel(t('Evaluation'))
    ->setDescription(t('The Evaluation the team evaluates'))
    ->setRevisionable(TRUE)
    ->setSetting('target_type', 'evaluation')
    ->setSetting('handler', 'default')
    ->setDisplayOptions('view', array(
      'label' => 'inline',
      'type' => 'entity_reference_label',
      'weight' => -10,
    ))
    ->setDisplayOptions('form', array(
      'type' => 'options_select',
      'weight' => -10,
    ))
    ->setDisplayConfigurable('form', TRUE)
    ->setDisplayConfigurable('view', TRUE);


  \Drupal::entityDefinitionUpdateManager()
    ->installFieldStorageDefinition('eval_id', 'project_team', 'team', $storage_definition);

Is there a change that should be made? Thanks.

  • Understand. My reply was fairly obtuse. What I meant was, of course I have cleared caches. Still have not updated that db table. thanks for your help. – MEI Apr 23 '18 at 19:51
0

If you look at this guide, defining field definitions, it all looks right. Do you get any errors, or does it still work?

Remember to clear the cache.

  • I get no errors, nothing in watchdog or on screen. Just no added field. – MEI Apr 20 '18 at 16:07
  • Have you cleared the cache – Jdrupal Apr 20 '18 at 16:40
  • Understand. My reply was fairly obtuse. What I meant was, of course I have cleared caches. Still have not updated that db table. thanks for your help. – MEI Apr 23 '18 at 19:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.