diff --git modules/product/commerce_product.info modules/product/commerce_product.info index 2983700..e6d5eab 100644 --- modules/product/commerce_product.info +++ 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 modules/product/commerce_product.install modules/product/commerce_product.install index b546c2e..0c3f234 100644 --- modules/product/commerce_product.install +++ modules/product/commerce_product.install @@ -91,6 +91,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; } @@ -105,3 +110,12 @@ function commerce_product_update_7100() { } db_add_index('commerce_product', 'product_type', array('type')); } + +/** + * 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); +} diff --git modules/product/commerce_product.module modules/product/commerce_product.module index 02bf0ec..f3a11c7 100644 --- modules/product/commerce_product.module +++ modules/product/commerce_product.module @@ -33,6 +33,8 @@ function commerce_product_entity_info() { 'controller class' => 'CommerceProductEntityController', 'base table' => 'commerce_product', 'fieldable' => TRUE, + 'field cache' => FALSE, + 'entity cache' => TRUE, 'entity keys' => array( 'id' => 'product_id', 'bundle' => 'type', diff --git modules/product/includes/commerce_product.controller.inc modules/product/includes/commerce_product.controller.inc index 7fbc022..4b9c4f9 100644 --- modules/product/includes/commerce_product.controller.inc +++ modules/product/includes/commerce_product.controller.inc @@ -9,7 +9,7 @@ * The controller class for products contains methods for the product CRUD * operations. The load method is inherited from the default controller. */ -class CommerceProductEntityController extends DrupalDefaultEntityController { +class CommerceProductEntityController extends EntityCacheDefaultEntityController { /** * Create a default product.