What's this strange error during entity_creation? I'm trying to create a (no bundle) entity from a feed using entity API, but I keep running into strange issue. The code for the entities is this:

function my_entity_provision() {
  $a = entity_create('entityType', array(
    'pid' =&gt; NULL,
    'aid' =&gt; 1,
    ...

  ))-&gt;save();
}


But when running it I run into these errors:

Warning: class_implements() [function.class-implements]: object or string expected in entity_create() (line 420 of ...../sites/all/modules/entity/entity.module).
Warning: in_array() expects parameter 2 to be array, boolean given in entity_create() (line 420 of ...../sites/all/modules/entity/entity.module).


I've tried looking on drupal and drupalcontrib for the correct implementation, but all code blocks show no text? :s

My code looks similar to Create Entity Programmatically in Drupal which does seem to work. (Since I have no bundle, I didn't define the type in the array, I read somewhere it can be omitted . But that made no difference anyway).

My entity info is as follows:

/**
 * Implements hook_entity_info().
 */ 
function my_entity_entity_info() {
  $return = array(
    'entityType' =&gt; array(
      'label' =&gt; t('entityType'),
      'controller class' =&gt; 'EntityAPIController',
      'base table' =&gt; 'entityTypes',
      'fieldable' =&gt; FALSE,
      'entity keys' =&gt; array(
        'id' =&gt; 'pid',
      ),
      'static cache' =&gt; TRUE,
      'view modes' =&gt; array(
        'full' =&gt; array(
          'label' =&gt; t('Full Entity'),
        ),
      ),
      'views controller class' =&gt; 'EntityDefaultViewsController',
    ),
  );

  return $return;
}
Argh, it seems the two different entity modules (core &amp; contrib) have confused me once again. 

The EntityAPIController I chose as controller class has no method save(). It uses entity_save($entity_type, $entity); instead.

So the function had to be: 

function my_entity_provision() {
  $a = entity_create('entityType', array(
    'pid' =&gt; NULL,
    'aid' =&gt; 1,
    ...

  ));
  entity_save('entityType', $a);
}