/** * {@inheritdoc} * * @param Uuid|null $value * @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform */ public function convertToDatabaseValue($value, AbstractPlatform $platform) { if (empty($value)) { return null; } if ($value instanceof Uuid) { return $value->getBytes(); } try { $uuid = Uuid::fromString($value); } catch (InvalidArgumentException $e) { throw ConversionException::conversionFailed($value, self::NAME); } return $uuid->getBytes(); }
/** * @param EntityManager $em * @param Uuid $uuid * * @return bool */ protected function findMatchingRow(EntityManager $em, Uuid $uuid) { return $em->find(self::$metadata->getName(), ['uuid' => $uuid->getBytes()]); }
/** * @return null|int */ public function getUuidBytes() { return $this->uuid ? $this->uuid->getBytes() : null; }