public function generateId()
    {
        if ($this->idAttributeType == static::$idTypeInteger) {
            do {
                $result = Number::randomNumber($this->idAttributePrefix, $this->idAttributeLength);
            } while ($this->checkIdExists((int) $result));
            return $result;
        }
        if ($this->idAttributeType == static::$idTypeString) {
            return $this->idAttributePrefix .
                Yii::$app->security->generateRandomString($this->idAttributeLength - strlen($this->idAttributePrefix));
        }
        if ($this->idAttributeType == static::$idTypeAutoIncrement) {
            return null;
        }
        return false;
    }
public function generateId()
    {
        if ($this->idAttributeType == static::$idTypeInteger) {
            do {
                $result = Number::randomNumber($this->idAttributePrefix, $this->idAttributeLength);
            } while ($this->checkIdExists((int) $result));
            return $result;
        }
        if ($this->idAttributeType == static::$idTypeString) {
            return $this->idAttributePrefix .
                Yii::$app->security->generateRandomString($this->idAttributeLength - strlen($this->idAttributePrefix));
        }
        if ($this->idAttributeType == static::$idTypeAutoIncrement) {
            return null;
        }
        return false;
    }
public function generateId ( ) { if ( $ this -> idAttributeType == static :: $ idTypeInteger ) { do { $ result = Number :: randomNumber ( $ this -> idAttributePrefix , $ this -> idAttributeLength ) ; } while ( $ this -> checkIdExists ( ( int ) $ result ) ) ; return $ result ; } if ( $ this -> idAttributeType == static :: $ idTypeString ) { return $ this -> idAttributePrefix . Yii :: $ app -> security -> generateRandomString ( $ this -> idAttributeLength - strlen ( $ this -> idAttributePrefix ) ) ; } if ( $ this -> idAttributeType == static :: $ idTypeAutoIncrement ) { return null ; } return false ; }
Generate the ID. You can override this method to implement your own
generation algorithm.
@return string the generated ID.
Generate the ID . You can override this method to implement your own generation algorithm .