Create bundles programmatically using ECK (Entity Construction Kit) The ECK module allows users to create custom entities. 

When using this modules UI it is possible to create an entity type, and then attach multiple bundles to the entity.

It is also possible to create new entity types via code. This page shows an example which is as follows:

$entity_type =  new EntityType();
$entity_type-&gt;name = "eck_employee";
$entity_type-&gt;label = "Employee";
// Following line is taken from the eck_example.install file
$entity_type-&gt;addProperty('name', 'Name', 'text');
$entity_type-&gt;save();


This doesn't however show how to create and attach bundles.

Is it possible to attach bundles to entities when creating them via code (using ECK)?
I just found a blog article here which gives an example on how to do exactly this:

After creating the entity type with the example code I gave in the question a bundle can be created as simply as this:

$entity_type_bundle = new Bundle();
$entity_type_bundle-&gt;name = 'eck_employee';
$entity_type_bundle-&gt;entity_type = 'eck_employee';
$entity_type_bundle-&gt;save();