diff --git a/registration.install b/registration.install index 4ff98d9..5746828 100644 --- a/registration.install +++ b/registration.install @@ -325,6 +325,19 @@ function registration_schema() { ), ); + // Create cache bins for Entity-cache module. + $cache_schema = drupal_get_schema_unprocessed('system', 'cache'); + $types = array( + 'registration', + 'registration_type', + 'registration_state', + ); + + foreach ($types as $type) { + $schema["cache_entity_$type"] = $cache_schema; + $schema["cache_entity_$type"]['description'] = "Cache table used to store $type entity records."; + } + return $schema; } @@ -453,3 +466,22 @@ function registration_update_7100(&$sandbox) { function registration_update_7101(&$sandbox) { db_drop_index('registration', 'entity_id_entity_type_user'); } + +/** + * Create cache bins for Entity-cache module. + */ +function registration_update_7102(&$sandbox) { + // Create cache bins for Entity-cache module. + $cache_schema = drupal_get_schema_unprocessed('system', 'cache'); + $types = array( + 'registration', + 'registration_type', + 'registration_state', + ); + + foreach ($types as $type) { + $schema["cache_entity_$type"] = $cache_schema; + $schema["cache_entity_$type"]['description'] = "Cache table used to store $type entity records."; + db_create_table("cache_entity_$type", $schema["cache_entity_$type"]); + } +} diff --git a/registration.module b/registration.module index 7fcb111..a10524a 100644 --- a/registration.module +++ b/registration.module @@ -62,7 +62,8 @@ function registration_entity_info() { 'uri callback' => 'entity_class_uri', 'token type' => 'registration', 'module' => 'registration', - 'label callback' => 'entity_class_label' + 'label callback' => 'entity_class_label', + 'entity cache' => module_exists('entitycache'), ), 'registration_type' => array( 'label' => t('Registration type'), @@ -86,6 +87,7 @@ function registration_entity_info() { 'file path' => drupal_get_path('module', 'registration') . '/includes', 'controller class' => 'RegistrationTypeUIController', ), + 'entity cache' => module_exists('entitycache'), ), 'registration_state' => array( 'label' => t('Registration State'), @@ -113,16 +115,11 @@ function registration_entity_info() { 'token type' => 'registration_state', 'module' => 'registration', 'access callback' => 'registration_state_access', - 'exportable' => TRUE + 'exportable' => TRUE, + 'entity cache' => module_exists('entitycache'), ), ); - // Support entity cache module. - if (module_exists('entitycache')) { - $entities['registration']['field cache'] = FALSE; - $entities['registration']['entity cache'] = TRUE; - } - return $entities; }