I created field with type Entity Reference and selected exists Entity Type as Target type. Then I deleted this Entity Type, after that I see error when I'm trying to edit settings of this field to change Target Entity type to another:

EntityFieldQueryException: Entity <em class="placeholder">{entity_name}</em> has no base table. in EntityFieldQuery->propertyQuery() (line 1191 of includes/entity.inc).

So I should to remove this field and create new one instead of just edit exist field settings and change Target Entity type.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Damien Tournoud’s picture

Status: Active » Needs review
FileSize
1.17 KB

Here is a proposal patch to make the base selection handler more robust in this case.

Status: Needs review » Needs work

The last submitted patch, 1345340-entityreference-missing-entity-type.patch, failed testing.

amitaibu’s picture

Maybe we should have this logic already in entityreference_get_selection_handler() -- like this other modules implementing a selection handler don't need to take care of this?

Damien Tournoud’s picture

Status: Needs work » Fixed

Merged into 7.x-1.x

This cannot be in entityreference_get_selection_handler() because there is no reason to impose that selection handlers only work on local entity types.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.