Drupal 7 creating a custom entity

158 views Asked by At

I'm trying to make a form with some fields and save the values in Drupal 7 where every user can enter their data. I tried creating a custom entity with an existing database table like so:

    function bank_info_entity_info() {
  return array(
    'bank_info' => array(
      'label' => t('BankInfo'),
      'entity class' => 'Entity',
      'base table' => 'bank_info',
      'field_ui_base_route'=> 'banking',
      'controller class' => 'EntityAPIController',
      'fieldable' => TRUE,
      'entity keys' => array(
        'id' => 'user_uid',
        '"bundle"' => 'bank_info',
      ),
      // Use the default label() and uri() functions
      'label callback' => 'entity_class_label',
      'uri callback' => 'entity_class_uri',
      //'module' => 'bank_info',
    ),
  );
}

and I keep getting this error: array_keys() expects parameter 1 to be array, null given common.inc:7334 PHP Warning: Invalid argument supplied for foreach() in /var/www/html/includes/common.inc on line 7314

when I run the command:

drupal_get_schema('bank_info')

It returns false which causes that error. Any ideas?

0

There are 0 answers