Model_Auth_User::unique_key_exists PHP Method

unique_key_exists() public method

Tests if a unique key value exists in the database.
public unique_key_exists ( $value, $field = NULL ) : boolean
return boolean
    public function unique_key_exists($value, $field = NULL)
    {
        if ($field === NULL) {
            // Automatically determine field by looking at the value
            $field = $this->unique_key($value);
        }
        return (bool) DB::select(array('COUNT("*")', 'total_count'))->from($this->_table_name)->where($field, '=', $value)->where($this->_primary_key, '!=', $this->pk())->execute($this->_db)->get('total_count');
    }