public function saveConfig($path, $value, $scope = ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $scopeCode = 'default')
    {
        $connection = $this->getConnection();
        $select = $connection->select()->from(
            $this->getMainTable()
        )->where(
            'path = ?',
            $path
        )->where(
            'scope = ?',
            $scope
        )->where(
            'scope_code = ?',
            $scopeCode
        );
        $row = $connection->fetchRow($select);

        $newData = ['scope' => $scope, 'scope_code' => $scopeCode, 'path' => $path, 'value' => $value];

        if ($row) {
            $whereCondition = [$this->getIdFieldName() . '=?' => $row[$this->getIdFieldName()]];
            $connection->update($this->getMainTable(), $newData, $whereCondition);

            return $this;
        }

        $connection->insert($this->getMainTable(), $newData);

        return $this;
    }
public function saveConfig($path, $value, $scope = ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $scopeCode = 'default')
    {
        $connection = $this->getConnection();
        $select = $connection->select()->from(
            $this->getMainTable()
        )->where(
            'path = ?',
            $path
        )->where(
            'scope = ?',
            $scope
        )->where(
            'scope_code = ?',
            $scopeCode
        );
        $row = $connection->fetchRow($select);

        $newData = ['scope' => $scope, 'scope_code' => $scopeCode, 'path' => $path, 'value' => $value];

        if ($row) {
            $whereCondition = [$this->getIdFieldName() . '=?' => $row[$this->getIdFieldName()]];
            $connection->update($this->getMainTable(), $newData, $whereCondition);

            return $this;
        }

        $connection->insert($this->getMainTable(), $newData);

        return $this;
    }
public function saveConfig ( $ path , $ value , $ scope = ScopeConfigInterface :: SCOPE_TYPE_DEFAULT , $ scopeCode = 'default' ) { $ connection = $ this -> getConnection ( ) ; $ select = $ connection -> select ( ) -> from ( $ this -> getMainTable ( ) ) -> where ( 'path = ?' , $ path ) -> where ( 'scope = ?' , $ scope ) -> where ( 'scope_code = ?' , $ scopeCode ) ; $ row = $ connection -> fetchRow ( $ select ) ; $ newData = [ 'scope' => $ scope , 'scope_code' => $ scopeCode , 'path' => $ path , 'value' => $ value ] ; if ( $ row ) { $ whereCondition = [ $ this -> getIdFieldName ( ) . '=?' => $ row [ $ this -> getIdFieldName ( ) ] ] ; $ connection -> update ( $ this -> getMainTable ( ) , $ newData , $ whereCondition ) ; return $ this ; } $ connection -> insert ( $ this -> getMainTable ( ) , $ newData ) ; return $ this ; }
Save config value

@param string $path      The config path
@param string $value     The config value
@param string $scope     The scope
@param string $scopeCode The scope Code

@return $this
Save config value