0

Description of entity type properties in code is very poor and I cannot find alternative resources. Could anyone explain those properties?

For example: "data_table" is described as:

The name of the entity type's data table.

But it doesn't explain anything.

I created a custom entity based on "examples" module, added "data_table", "revision_table", "revision_data_table", added revision entity key, but after drush updatedb --entity-updates only myentity_revision table was added, and I still cannot see myentity_data_table, and other tables that "node" entity is using for example. Why is that?

Could someone explain those properties, what they are precisely for, and as a bonus - how they relates to "setRevisionable/setTranslatable" methods that we can invoke when creating field definition?

2
  • Reinstall the module. I think schema rebuilding works only for fields.
    – user21641
    Feb 11, 2016 at 17:09
  • After reinstalling nothing changed. What is lacking is just clear explanation of entity type properties and tables layouts. If I had just this I would figure everything else by myself. Feb 11, 2016 at 17:14

1 Answer 1

0

I had to re-install to get it to work, AFAIK. The data_table is initially empty, but gets filled up as soon as you start creating a few of your custom entities. But the table itself should be there.

What exactly the data_table is for, I'm clueless as well, as pretty much everything worked without declaring it.

I couldn't however get the Entity Autocomplete ( see here for more info/example ) form element to work without declaring the data_table. As soon as I added the annotation, the autocomplete element worked by declaring #target_type => 'my_custom_entity'

1
  • I did some tests and it seems that "data tables" are only used when entity is translatable. Funnily enough "translatable" property visible in example entity in "examples" module seems to not exist at all - even Node is not using it! But it seems to be only matter of declaring langcode entity key - only then "data" tables seems to appear. I kind of understand this now, but lack of documentation is really depressing. When I will figure this out by analyzing core, I may write some articles on it. Feb 11, 2016 at 20:15

Your Answer

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

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