/** * Init Model */ public function init() { parent::init(); /** * Init string primary key */ if (is_array($this->_primary)) { $this->_sPrimary = current($this->_primary); } else { $this->_sPrimary = $this->_primary; } /** * Init database prefix */ $config = Vi_Registry::get('config'); if (isset($config['database']['params']['prefix']) && null != $config['database']['params']['prefix']) { $this->_prefix = $config['database']['params']['prefix']; } }