diff --git a/includes/commerce.controller.inc b/includes/commerce.controller.inc index 5605f67..d61af37 100644 --- a/includes/commerce.controller.inc +++ b/includes/commerce.controller.inc @@ -7,7 +7,7 @@ * A full fork of Entity API's controller, with support for revisions. */ -class DrupalCommerceEntityController extends DrupalDefaultEntityController implements EntityAPIControllerInterface { +class DrupalCommerceEntityController extends EntityCacheDefaultEntityController implements EntityAPIControllerInterface { /** * Stores our transaction object, necessary for pessimistic locking to work. diff --git a/modules/product/commerce_product.info b/modules/product/commerce_product.info index abc14e8..e281de1 100644 --- a/modules/product/commerce_product.info +++ b/modules/product/commerce_product.info @@ -2,6 +2,7 @@ name = Product description = Defines the Product entity and associated features. package = Commerce dependencies[] = rules +dependencies[] = entitycache dependencies[] = commerce dependencies[] = commerce_price core = 7.x diff --git a/modules/product/commerce_product.install b/modules/product/commerce_product.install index de1559f..eb7e77a 100644 --- a/modules/product/commerce_product.install +++ b/modules/product/commerce_product.install @@ -183,6 +183,11 @@ function commerce_product_schema() { ), ); + // Create own cache bin to integrate with entitycache module + $cache_schema = drupal_get_schema_unprocessed('system', 'cache'); + $schema['cache_entity_commerce_product'] = $cache_schema; + $schema['cache_entity_commerce_product']['description'] = 'Cache table used to store commerce_product entity records.'; + return $schema; } @@ -207,6 +212,15 @@ function commerce_product_update_7100() { } /** + * Adds the own cache bin to integrate with entitycache. + */ +function commerce_product_update_7101() { + $cache_schema = drupal_get_schema_unprocessed('system', 'cache'); + $cache_schema['description'] = 'Cache table used to store commerce_product entity records.'; + db_create_table('cache_entity_commerce_product', $cache_schema); +} + +/** * Update permission names for product entity management. */ function commerce_product_update_7101() { diff --git a/modules/product/commerce_product.module b/modules/product/commerce_product.module index b5c0958..ef01f09 100644 --- a/modules/product/commerce_product.module +++ b/modules/product/commerce_product.module @@ -80,6 +80,8 @@ function commerce_product_entity_info() { 'base table' => 'commerce_product', 'revision table' => 'commerce_product_revision', 'fieldable' => TRUE, + 'field cache' => FALSE, + 'entity cache' => TRUE, 'entity keys' => array( 'id' => 'product_id', 'bundle' => 'type', @@ -932,4 +934,4 @@ function template_preprocess_commerce_product_sku(&$variables) { */ function template_preprocess_commerce_product_title(&$variables) { $variables['title'] = check_plain($variables['title']); -} \ No newline at end of file +}