예제 #1
0
 /**
  * @param string $sHashID
  * @param array $aParams
  *
  * @return string|bool
  */
 public function createMin($sHashID, $aParams)
 {
     $mResult = false;
     $sNewMin = '';
     if (is_string($sHashID) && 0 < strlen($sHashID) && false !== $this->getMinByID($sHashID)) {
         return false;
     }
     while (true) {
         $sNewMin = api_Utils::GenerateShortHashString(10);
         if (false === $this->getMinByHash($sNewMin)) {
             break;
         }
     }
     if (0 < strlen($sNewMin)) {
         $aParams['__hash_id__'] = $sHashID;
         $aParams['__hash__'] = $sNewMin;
         $aParams['__time__'] = time();
         $aParams['__time_update__'] = time();
         if ($this->oConnection->Execute($this->oCommandCreator->createMin($sNewMin, md5($sHashID), @\json_encode($aParams)))) {
             $mResult = $sNewMin;
         }
     }
     $this->throwDbExceptionIfExist();
     return $mResult;
 }