array_keys() expects parameter 1 to be array, null given in drupal_schema_fields_sql()? i have developed a custom module which will calculate the employee salary . I have created the hook_schema() like this

This is mymodule.install file with two entities

function payroll_schema() {
$schema['payroll'] = array(
  'description' =&gt; 'A detail payroll structure for an employee',
  'fields' =&gt; array(
    'payroll_id' =&gt; array(
      'description' =&gt; 'payroll id',//this is my primary key.
      'type' =&gt; 'serial',
      'unsigned' =&gt; TRUE,
      'not null' =&gt; TRUE,
    ),
    'paid_days' =&gt; array(
      'description' =&gt; 'Working days of an employee',
      'type' =&gt; 'int',
      'unsigned' =&gt; TRUE,
      'not null' =&gt; TRUE,
    ),
  ...
  ...
  'primary_key' =&gt; array('payroll_id'),
);
$schema['payroll_item'] = array(
  'description' =&gt; 'Details of payroll items',
  'fields' =&gt; array(
    'item_id' =&gt; array(
      'description' =&gt; 'item_id',
      'type' =&gt; 'serial',
      'unsigned' =&gt; TRUE,
      'not null' =&gt; TRUE,
    ),
    'payroll_items_id' =&gt; array(
      'description' =&gt; 'Payroll id', //foreign key
      'type' =&gt; 'int',
      'unsigned' =&gt; TRUE,
      'not null' =&gt; TRUE,
    ),
    ...
    ...

  ),
  'primary key' =&gt; array('item_id'),
  'foreign keys' =&gt; array(
    'payroll_items_id' =&gt; array(
      'table' =&gt; 'payroll',
      'columns' =&gt; array('payroll_items_id' =&gt; 'payroll_id'),
    ),
   ),
);
}


Here is the mymodule.module file with hook_entity_info()

function payroll_entity_info() {
  $return['payroll'] = array(
    'label' =&gt; t('Payroll'),
    'entity class' =&gt; 'Payroll',
    'controller class' =&gt; 'PayrollController',
    'base table' =&gt; 'payroll',
    'fieldable' =&gt; TRUE,
    'entity keys' =&gt; array(
      'id' =&gt; 'payroll_id',
      'label' =&gt; 'Payroll id',
    ),
    'module' =&gt; 'payroll',
    'view modes' =&gt; array(
    'full' =&gt; array(
       'label' =&gt; t('Full content'),
       'custom settings' =&gt; FALSE,
       ),
    ),
  );
  $return['payroll_item'] = array(
    'label' =&gt; t('Payroll Item'),
    'entity class' =&gt; 'PayrollItem',
    'controller class' =&gt; 'PayrollItemController',
    'base table' =&gt; 'payroll_item',
    'fieldable' =&gt; FALSE,
    'entity keys' =&gt; array(
      'id' =&gt; 'item_id',
      'label' =&gt; 'Item id',
    ),
    'module' =&gt; 'payroll',
    'view modes' =&gt; array(
    'full' =&gt; array(
      'label' =&gt; t('Full content'),
      'custom settings' =&gt; FALSE,
      ),
    ),
  );
  return $return;
}


Here is the entity_load ()

function payroll_load($id) {
  $payrolls = entity_load('payroll', array($id));
  return reset($payrolls);
}


And here is my mymodule.controller.inc 

class PayrollController extends DrupalDefaultEntityController {
  public function __construct($payroll) {
  parent::__construct('payroll');
  }
  public function create() {
  $payrolls = new StdClass();
  return $payrolls;
  }
}
class PayrollItemController extends DrupalDefaultEntityController {
  public function __construct($payroll_items) {
  parent::__construct('payroll_item');
  }
  public function create() {
  $payroll_items = new StdClass();
  return $payroll_items;
  }
}


When i am trying to install a module it gives a error as:


  Warning: array_keys() expects parameter 1 to be array, null given in
  drupal_schema_fields_sql()  (line 6969 of
  mylocation/includes/common.inc).


Can you tell me where i may made any mistake ??
You've forgotten to return anything from your implementation of hook_schema().

Just add return $schema; to the end of the function, and re-install your module.