concrete/src/Utility/Service/Identifier.php
public function generate($table, $key, $length = 12, $lowercase = false)
    {
        $foundHash = false;
        $db = Application::make(Connection::class);
        while ($foundHash == false) {
            $string = $this->getString($length);
            if ($lowercase) {
                $string = strtolower($string);
            }
            $cnt = $db->GetOne("select count(" . $key . ") as total from " . $table . " where " . $key . " = ?",
                array($string));
            if ($cnt < 1) {
                $foundHash = true;
            }
        }

        return $string;
    }
public function generate($table, $key, $length = 12, $lowercase = false)
    {
        $foundHash = false;
        $db = Application::make(Connection::class);
        while ($foundHash == false) {
            $string = $this->getString($length);
            if ($lowercase) {
                $string = strtolower($string);
            }
            $cnt = $db->GetOne("select count(" . $key . ") as total from " . $table . " where " . $key . " = ?",
                array($string));
            if ($cnt < 1) {
                $foundHash = true;
            }
        }

        return $string;
    }
public function generate ( $ table , $ key , $ length = 12 , $ lowercase = false ) { $ foundHash = false ; $ db = Application :: make ( Connection :: class ) ; while ( $ foundHash == false ) { $ string = $ this -> getString ( $ length ) ; if ( $ lowercase ) { $ string = strtolower ( $ string ) ; } $ cnt = $ db -> GetOne ( "select count(" . $ key . ") as total from " . $ table . " where " . $ key . " = ?" , array ( $ string ) ) ; if ( $ cnt < 1 ) { $ foundHash = true ; } } return $ string ; }
Generates a unique identifier for an item in a database table. Used, among other places, in generating
User hashes for email validation.

@param string $table
@param string $key
@param int $length
@param bool $lowercase

@return string
Generates a unique identifier for an item in a database table . Used among other places in generating User hashes for email validation .