0

If I submit single value from dropdown of custom entity field then it will save in data in db. below is the code, working fine.

$fields['participants'] = BaseFieldDefinition::create('entity_reference')
  ->setLabel(t('Participants'))
  ->setDescription(t('The Participants of the report.'))
  ->setSetting('target_type', 'taxonomy_term')
  ->setSetting('handler', 'default:taxonomy_term')
  ->setSetting('handler_settings', 
      array(
    'target_bundles' => array(
     'stakeholders' => 'stakeholders'
    )))
  ->setDisplayOptions('view', array(
    'label' => 'hidden',
    'type' => 'list_default',
    'weight' => 0,
  ))
  ->setDisplayOptions('form', array(
    'type' => 'options_select',
    'weight' => 3,
    'settings' => array(
      'match_operator' => 'CONTAINS',
      'size' => '60',
      'autocomplete_type' => 'tags',
      'placeholder' => '',
    ),
  ))
  ->setDisplayConfigurable('form', TRUE)
  ->setDisplayConfigurable('view', TRUE);

when I want to submit multiple value by selecting multiple value from same dropdown by using

->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED)

this will allow me to select multiple value from dropdown but when I submit form it will give error like

Base table or view not found: 1146 Table 'tempmukun.reports__participants' doesn't exist

no idea what I am missing, Does any one have idea? Thanks

Your Answer

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

Browse other questions tagged or ask your own question.