Exemple #1
0
 public function testFromBytes()
 {
     $uuid1 = Uuid::fromString(self::UUID4_STRING);
     $bytes = $uuid1->getBytes();
     $uuid2 = Uuid::fromBytes($bytes);
     $this->assertTrue($uuid1->equals($uuid2));
 }
 public function convertToPHPValue($value, AbstractPlatform $platform)
 {
     if (empty($value)) {
         return null;
     }
     if ($value instanceof Uuid) {
         return $value;
     }
     try {
         $uuid = Uuid::fromBytes($value);
     } catch (InvalidArgumentException $e) {
         throw ConversionException::conversionFailed($value, self::NAME);
     }
     return $uuid;
 }
 /**
  * @param $params
  * @return array
  */
 private function getSafeParamValues($params)
 {
     $safeValues = [];
     foreach (array_values($params) as $value) {
         if (is_array($value)) {
             $safeValues[] = $this->getSafeParamValues($value);
         } else {
             if ($this->isBinary($value)) {
                 $value = Uuid::fromBytes($value)->toString();
             }
             $safeValues[] = $value;
         }
     }
     return $safeValues;
 }