Hi everybody,

I'm currently working on a custom module to manage some kind of wishlist. I'd like to create an entity for that. I had a look at the examples I could find, e.g. the example module, but they are all declaring an entity with entity types. In my case, I want to create an entity called say "wishlist" and I don't need any "subtypes".
Knowing that, when implementing HOOK_entity_info I don't know what to do with those parameters :

'entity keys' => array(
        'id' => 'wid',
        'bundle' => 'type',
),
'bundle keys' => array(
        'bundle' => 'type',
),
'bundles' => array(),

Should I just use this ?:

'entity keys' => array(
        'id' => 'wid',
),
'bundle keys' => array(),
'bundles' => array(),

If someone knows a module doing working like that and could share it with me it would be great.
If I'm getting it wrong and "types" are required please let me know.

Thank you!

Comments

jaypan’s picture

Entities are abstract, and cannot be used as-is. They only become concrete when they are given a bundle (aka type), so you will need to create at least one 'type'. Just name the bundle type the same as the entity type.

Contact me to contract me for D7 -> D10/11 migrations.

ouissla’s picture

Thanks for your quick answer, it makes a bit more sense now ;)