public function createGemsUserId($value, $isNew = false, $name = null, array $context = array())
    {
        if ($value) {
            return $value;
        }

        $creationTime = new \MUtil_Db_Expr_CurrentTimestamp();

        do {
            $out = mt_rand(1, 9);
            for ($i = 1; $i < $this->userIdLen; $i++) {
                $out .= mt_rand(0, 9);
            }
            // Make it a number
            $out = intval($out);

            try {
                if (0 === $this->db->insert('gems__user_ids', array('gui_id_user' => $out, 'gui_created' => $creationTime))) {
                    $out = null;
                }
            } catch (\Zend_Db_Exception $e) {
                $out = null;
            }
        } while (null === $out);

        return $out;
    }
public function createGemsUserId($value, $isNew = false, $name = null, array $context = array())
    {
        if ($value) {
            return $value;
        }

        $creationTime = new \MUtil_Db_Expr_CurrentTimestamp();

        do {
            $out = mt_rand(1, 9);
            for ($i = 1; $i < $this->userIdLen; $i++) {
                $out .= mt_rand(0, 9);
            }
            // Make it a number
            $out = intval($out);

            try {
                if (0 === $this->db->insert('gems__user_ids', array('gui_id_user' => $out, 'gui_created' => $creationTime))) {
                    $out = null;
                }
            } catch (\Zend_Db_Exception $e) {
                $out = null;
            }
        } while (null === $out);

        return $out;
    }
public function createGemsUserId ( $ value , $ isNew = false , $ name = null , array $ context = array ( ) ) { if ( $ value ) { return $ value ; } $ creationTime = new \ MUtil_Db_Expr_CurrentTimestamp ( ) ; do { $ out = mt_rand ( 1 , 9 ) ; for ( $ i = 1 ; $ i < $ this -> userIdLen ; $ i ++ ) { $ out .= mt_rand ( 0 , 9 ) ; } // Make it a number $ out = intval ( $ out ) ; try { if ( 0 === $ this -> db -> insert ( 'gems__user_ids' , array ( 'gui_id_user' => $ out , 'gui_created' => $ creationTime ) ) ) { $ out = null ; } } catch ( \ Zend_Db_Exception $ e ) { $ out = null ; } } while ( null === $ out ) ; return $ out ; }
Create a Gems project wide unique user id

@see \Gems_Model_RespondentModel

@param mixed $value The value being saved
@param boolean $isNew True when a new item is being saved
@param string $name The name of the current field
@param array $context Optional, the other values being saved
@return int
Create a Gems project wide unique user id