Recently, Views was updated to use data tables (the data_table annotation on @ContentEntityType) by default. See the change record at https://www.drupal.org/node/2433153.

This caught me out since I had both defined on my entity. I hadn't thought much about it, and I don't even know which example got me to do that. I think I may have based mine off \Drupal\comment\Entity\Comment.

Anyway, what's the difference in terms of when they get used? It seems that, despite having defined data_table, all my data was being saved in the base_table anyway, and this caused Views not to work until I removed the data_table property from my @ContentEntityType definition altogether.

It seems my fields ought to be using data_table. What did I do wrong in my entity? I'm porting a module and thus using 8.0.0-beta9.

1 Answer 1


My guess is that you didn't actually set the translatable flag to TRUE. The data_table is only used then, but I guess views gets confused if you have it set but the entity type is not translatable, sounds like a bug in views but it also doesn't make sense to define the table and not have your entity type translatable.

The difference of those two tables is that it contains a row for each translation of your entity type. For example, {ńode} has just the nid, vid (which is the current revision), type and uuid. All the other fields are in the data table, like the node title, status, changed date, and so on.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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