Problem/Motivation

I have successfully added new columns (sub-field) to a custom field using the provided PHP code in the documentation, but when trying to add an entity_reference column I get this error

>  [warning] Undefined array key "target_type" EntityReference.php:33
>  [error]  Field 'xxxx' references a target entity type '' which does not exist.

In my case the entity_reference is towards a taxonomy_term, I tried to add
'target_type' => 'taxonomy_term'
to the array of $options parameters but nothing changes.

What is the syntax to add an entity_reference column?
thanks

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Giuse69 created an issue. See original summary.

apmsooner’s picture

Entity reference is not currently supported but I'll work on it. Thanks for bringing to my attention.

apmsooner’s picture

Version: 3.0.0-rc3 » 3.0.x-dev
apmsooner’s picture

Title: Adding a new column/sub-field of type entity_reference » Enhance updater service to support all field types
Component: Documentation » Code
Category: Support request » Task

apmsooner’s picture

Status: Active » Needs review
apmsooner’s picture

The syntax is correct. The original code just wasn't accounting for it. You can try this now with the patch and as long as you have a valid entity type as the target_type, it should process. There is validation in place to ensure a valid target_type is included when data type is entity_reference and will provide messaging in the exception if not.

apmsooner’s picture

Status: Needs review » Fixed

  • apmsooner committed d069642c on 3.0.x
    Issue #3462856 by apmsooner: Enhance updater service to support all...
apmsooner’s picture

Status: Fixed » Closed (fixed)