/** * Constructor with parameters * * @param array $args Array of arguments with keys * - 'metadata' Enterprise_Mview_Model_Metadata * - 'connection' Varien_Db_Adapter_Interface * - 'factory' Enterprise_Mview_Model_Factory */ public function __construct(array $args) { $this->_app = !empty($args['app']) ? $args['app'] : Mage::app(); $this->_factory = $args['factory']; parent::__construct($args); /** @var $changelog Enterprise_Index_Model_Changelog */ $changelog = $this->_factory->getModel('enterprise_index/changelog', array('connection' => $this->_connection, 'metadata' => $this->_metadata)); $this->_changedIds = $changelog->loadByMetadata(); $this->_changedIds = array_unique($this->_changedIds); }
/** * Execute additional operations after reindex * * @return Enterprise_Catalog_Model_Index_Action_Catalog_Category_Product_Refresh */ protected function _afterReindex() { $this->_updateMetadata(); /** @var $client Enterprise_Mview_Model_Client */ $client = $this->_factory->getModel('enterprise_mview/client'); $client->init($this->_getPairedIndexerCode())->getMetadata()->setValidStatus()->save(); return $this; }
/** * Execute action * * @param string $classPath * @param array $args * @return Enterprise_Mview_Model_Client * @throws Enterprise_Mview_Exception */ public function execute($classPath, array $args = array()) { if (!is_object($this->_metadata)) { throw new Enterprise_Mview_Exception('Metadata should be initialized before action is executed'); } $args = $this->_prepareActionParameters($args); $action = $this->_factory->getModel($classPath, $args); if (!$action instanceof Enterprise_Mview_Model_Action_Interface) { throw new Enterprise_Mview_Exception('Action "' . get_class($action) . '" must be an instance of ' . 'Enterprise_Mview_Model_Action_Interface'); } $action->execute(); return $this; }
/** * Returns subscriber collection instance * * @return Enterprise_Mview_Model_Resource_Subscriber_Collection */ protected function _getSubscriberCollection() { return $this->_factory->getModel('enterprise_mview/subscriber')->getCollection(); }