/** * Init materialized view metadata * * @param string $name * @return Enterprise_Mview_Model_Client */ public function init($name) { $tableName = $this->_factory->getSingleton('core/resource')->getTableName($name); $this->_metadata = $this->_factory->getModel('enterprise_mview/metadata')->load($tableName, 'table_name'); if (!$this->_metadata->getId()) { $this->_metadata->setTableName($tableName); } return $this; }
/** * Validate metadata before execute * * @return Enterprise_Mview_Model_Action_Mview_Refresh_Changelog * @throws Enterprise_Mview_Exception */ protected function _validate() { if (!$this->_metadata->getId() || !$this->_metadata->getChangelogName()) { throw new Enterprise_Mview_Exception('Can\'t perform operation, incomplete metadata!'); } return $this; }
/** * Init materialized view metadata by table name * * @param string $tableName * * @return Enterprise_Mview_Model_Client */ public function initByTableName($tableName) { $this->_metadata = $this->_factory->getModel('enterprise_mview/metadata')->load($tableName, 'table_name'); if (!$this->_metadata->getId()) { $this->_metadata->setTableName($tableName); } return $this; }
/** * Set changelog valid * * @return Enterprise_Index_Model_Action_Abstract */ protected function _setChangelogValid() { $this->_metadata->load($this->_metadata->getId()); if ($this->_metadata->getStatus() == Enterprise_Mview_Model_Metadata::STATUS_IN_PROGRESS) { $this->_metadata->setValidStatus(); } $this->_metadata->setVersionId($this->_getCurrentVersionId())->save(); return $this; }