protected function _checkUnique(\Magento\Framework\Model\AbstractModel $object)
    {
        $select = $this->getConnection()->select()->from(
            $this->getMainTable(),
            [$this->getIdFieldName()]
        )->where(
            'scope = :scope'
        )->where(
            'scope_code = :scope_code'
        )->where(
            'path = :path'
        );
        $bind = [
            'scope'    => $object->getScope(),
            'scope_code' => $object->getScopeCode(),
            'path'     => $object->getPath(),
        ];

        $configId = $this->getConnection()->fetchOne($select, $bind);
        if ($configId) {
            $object->setId($configId);
        }

        return $this;
    }
protected function _checkUnique(\Magento\Framework\Model\AbstractModel $object)
    {
        $select = $this->getConnection()->select()->from(
            $this->getMainTable(),
            [$this->getIdFieldName()]
        )->where(
            'scope = :scope'
        )->where(
            'scope_code = :scope_code'
        )->where(
            'path = :path'
        );
        $bind = [
            'scope'    => $object->getScope(),
            'scope_code' => $object->getScopeCode(),
            'path'     => $object->getPath(),
        ];

        $configId = $this->getConnection()->fetchOne($select, $bind);
        if ($configId) {
            $object->setId($configId);
        }

        return $this;
    }
protected function _checkUnique ( \ Magento \ Framework \ Model \ AbstractModel $ object ) { $ select = $ this -> getConnection ( ) -> select ( ) -> from ( $ this -> getMainTable ( ) , [ $ this -> getIdFieldName ( ) ] ) -> where ( 'scope = :scope' ) -> where ( 'scope_code = :scope_code' ) -> where ( 'path = :path' ) ; $ bind = [ 'scope' => $ object -> getScope ( ) , 'scope_code' => $ object -> getScopeCode ( ) , 'path' => $ object -> getPath ( ) , ] ; $ configId = $ this -> getConnection ( ) -> fetchOne ( $ select , $ bind ) ; if ( $ configId ) { $ object -> setId ( $ configId ) ; } return $ this ; }
Validate unique configuration data before save
Set id to object if exists configuration instead of throw exception

@SuppressWarnings(PHPMD.CamelCaseMethodName)

@param \Magento\Framework\Model\AbstractModel $object The current configuration value being saved

@return $this
Validate unique configuration data before save Set id to object if exists configuration instead of throw exception