src/Common/CodeIgniter/Libraries/FormValidation.php
public function is_unique($sString, $sParameters)
    {
        $aParameters   = explode('.', $sParameters);
        $sTable        = ArrayHelper::getFromArray(0, $aParameters);
        $sColumn       = ArrayHelper::getFromArray(1, $aParameters);
        $sIgnoreId     = ArrayHelper::getFromArray(2, $aParameters);
        $sIgnoreColumn = ArrayHelper::getFromArray(3, $aParameters, 'id');

        $oDb = Factory::service('Database');
        $oDb->where($sColumn, $sString);
        if ($sIgnoreId) {
            $oDb->where($sIgnoreColumn . ' !=', $sIgnoreId);
        }
        return $oDb->count_all_results($sTable) === 0;
    }
public function is_unique($sString, $sParameters)
    {
        $aParameters   = explode('.', $sParameters);
        $sTable        = ArrayHelper::getFromArray(0, $aParameters);
        $sColumn       = ArrayHelper::getFromArray(1, $aParameters);
        $sIgnoreId     = ArrayHelper::getFromArray(2, $aParameters);
        $sIgnoreColumn = ArrayHelper::getFromArray(3, $aParameters, 'id');

        $oDb = Factory::service('Database');
        $oDb->where($sColumn, $sString);
        if ($sIgnoreId) {
            $oDb->where($sIgnoreColumn . ' !=', $sIgnoreId);
        }
        return $oDb->count_all_results($sTable) === 0;
    }
public function is_unique ( $ sString , $ sParameters ) { $ aParameters = explode ( '.' , $ sParameters ) ; $ sTable = ArrayHelper :: getFromArray ( 0 , $ aParameters ) ; $ sColumn = ArrayHelper :: getFromArray ( 1 , $ aParameters ) ; $ sIgnoreId = ArrayHelper :: getFromArray ( 2 , $ aParameters ) ; $ sIgnoreColumn = ArrayHelper :: getFromArray ( 3 , $ aParameters , 'id' ) ; $ oDb = Factory :: service ( 'Database' ) ; $ oDb -> where ( $ sColumn , $ sString ) ; if ( $ sIgnoreId ) { $ oDb -> where ( $ sIgnoreColumn . ' !=' , $ sIgnoreId ) ; } return $ oDb -> count_all_results ( $ sTable ) === 0 ; }
Checks a value is uniqe in a given table

@param string $sString     The string to check
@param string $sParameters Period separated parameters; table.column.ignore_id.ignore_id_column

@return bool
Checks a value is uniqe in a given table