public function testGetCompositeTypes() { $types = Mage_Catalog_Model_Product_Type::getCompositeTypes(); $this->assertInternalType('array', $types); $this->assertContains(Mage_Catalog_Model_Product_Type::TYPE_GROUPED, $types); $this->assertContains(Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE, $types); $this->assertContains(Mage_Catalog_Model_Product_Type::TYPE_BUNDLE, $types); }
/* @var $this Mage_Core_Model_Resource_Setup */ /** @var $indexHelper Enterprise_Index_Helper_Data */ $indexHelper = Mage::helper('enterprise_index'); /** @var $client Enterprise_Mview_Model_Client */ $client = Mage::getModel('enterprise_mview/client'); $client->init('catalogsearch_fulltext'); $client->getMetadata()->setKeyColumn('product_id')->setViewName('catalogsearch_fulltext_cl')->setStatus(Enterprise_Mview_Model_Metadata::STATUS_INVALID)->setGroupCode('catalogsearch_fulltext')->save(); $client->execute('enterprise_index/action_index_changelog_create'); $subscriptions = array($this->getTable('catalog/product') => 'entity_id', $this->getTable(array('catalog/product', 'decimal')) => 'entity_id', $this->getTable(array('catalog/product', 'int')) => 'entity_id', $this->getTable(array('catalog/product', 'text')) => 'entity_id', $this->getTable(array('catalog/product', 'varchar')) => 'entity_id', $this->getTable(array('catalog/product', 'datetime')) => 'entity_id'); /** @var $resources mage_core_model_resource */ $resources = Mage::getSingleton('core/resource'); /** @var $productType mage_catalog_model_product_type */ $productType = Mage::getSingleton('catalog/product_type'); $productEmulator = new Varien_Object(); $productEmulator->setIdFieldName('entity_id'); foreach (Mage_Catalog_Model_Product_Type::getCompositeTypes() as $typeId) { $productEmulator->setTypeId($typeId); /** @var $typeInstance Mage_Catalog_Model_Product_Type_Abstract */ $typeInstance = $productType->factory($productEmulator); /** @var $relation bool|Varien_Object */ $relation = $typeInstance->isComposite() ? $typeInstance->getRelationInfo() : false; if ($relation && $relation->getTable()) { $tableName = $resources->getTableName($relation->getTable()); $subscriptions[$tableName] = $relation->getParentFieldName(); } } foreach ($subscriptions as $targetTable => $targetColumn) { $arguments = array('target_table' => $targetTable, 'target_column' => $targetColumn); $client->execute('enterprise_mview/action_changelog_subscription_create', $arguments); } $events = array();