Entities, bundles and fields I've created entities and bundles through Entity Construction Kit UI, and now I'm trying to re-create everything with code, in a module.
I managed to generate entity with Drupal console, added fields, and everything works well.

The problem is when I try to create bundles for an entity, with different fields.
In ECK, I can create an entity, then bundles, and add different fields to each bundle.
However, I can't understand how to do it in the code, and after reading tons of documentation, it feels like bundles are only configuration entities and can't have fields.

So my questions are :


Is there something I don't understand ?
How can I mimic ECK "bundles with fields" in code ? My goal is to create profiles, like the profile module can do for users, but referenced from an other entity, and with specific behavior, so I'd prefer create my own entities.
Yes, the bundle entities themself are not fieldable.

But bundle config entities in the end only exist to manage bundles for the content entity type, and as far as content entities are concerned, bundles are basically just a string (and a bit of metadata like a title). It's even possible to have bundles based on plugins or other things.

Per-bundle fields (usually configurable fields defined only in config, but it would be possible to define them in code as well, currently not trivial) are then attached to a content entity type + specific bundle. Fields actually consist of two definitions: field storage, which is tied to the entity type and defines name and storage-level settings, and the field, which is for a bundle and has bundle-level settings, label and so on. Base field definitions defined in the baseFieldDefinitions() method are exposed as both the field storage and field definition.

Haven't yet read it in detail, but http://www.daggerhart.com/drupal-8-custom-entities-bundles/ is a recent (as in, ~1h old) extensive resource on how to build entity types with bundles.