/** * Refresh materialized view * * @throws Exception * @throws Exception */ public function refresh() { if (!$this->getMviewName() || !$this->getViewName()) { throw new Exception('Cann\'t refresh materialized view, because metadata doesn\'t contains enough information!!'); } try { $this->_commandFactory->getCommandRefresh($this->getMviewName(), $this->getViewName())->execute(); $this->setStatus(self::MVIEW_STATUS_VALID)->setRefreshedAt(now()); } catch (Exception $e) { $this->setStatus(self::MVIEW_STATUS_INVALID); throw $e; } $this->save(); }