public function init($config)
    {
        $this->_initiated = true;
        if ($this->isNewRecord()) {
            $this->_tableName = static::getTableName();
            $this->_db = $this->_db ? $this->_db : static::getDb();
            $this->_columns = static::getDb()->getTableColumns($this->_tableName);
            $this->_pk = static::getDb()->getTablePk($this->_tableName);
        } else {
            if (is_array($this->_pk)) {
                $this->_originalPk = [];
                foreach ($this->_pk as $k) {
                    $this->_originalPk[$k] = $this->_attributes[$k];
                }
            } else {
                $this->_originalPk = $this->_attributes[$this->_pk];
            }
            $this->afterLoad();
        }
        $this->applyRelationsAttributes();
        return parent::init($config);
    }