/** * {@inheritdoc} */ public function getBinding(Uuid $uuid) { if (!isset($this->keysByUuid[$uuid->toString()])) { throw NoSuchBindingException::forUuid($uuid); } $key = $this->keysByUuid[$uuid->toString()]; if (!isset($this->bindingsByKey[$key])) { $this->loadBindingsForKey($key); } foreach ($this->bindingsByKey[$key] as $binding) { if ($binding->getUuid()->equals($uuid)) { return $binding; } } // This does not happen except if someone plays with the key-value store // contents (or there's a bug here..) throw new RuntimeException('The discovery is corrupt. Please rebuild it.'); }
/** * @return string */ public function toString() { return static::toOrderedUuid($this->uuid->toString()); }
/** * Creates an exception for a UUID. * * @param Uuid $uuid The UUID of the binding. * @param Exception|null $cause The exception that caused this exception. * * @return static The created exception. */ public static function forUuid(Uuid $uuid, Exception $cause = null) { return new static(sprintf('The binding "%s" does not exist.', $uuid->toString()), 0, $cause); }
/** * Serializes the uuid. * @param VisitorInterface $visitor * @param Uuid $uuid * @return string */ public function serialize(VisitorInterface $visitor, Uuid $uuid) { return $uuid->toString(); }
/** * {@inheritdoc} */ public function getBinding(Uuid $uuid) { if (!isset($this->bindings[$uuid->toString()])) { throw NoSuchBindingException::forUuid($uuid); } return $this->bindings[$uuid->toString()]; }
protected function preSerialize(array &$data) { $data[] = $this->typeName; $data[] = $this->userParameterValues; $data[] = $this->uuid->toString(); }
/** * @Route("/optionalAutomatic/{uuid}") */ public function optionalAutomaticAction(Uuid $uuid = null) { return new Response($uuid ? $uuid->toString() : null); }
/** * @return string */ public function __toString() { return $this->value->toString(); }
public function serializeUuid(VisitorInterface $visitor, Uuid $uuid, array $type, Context $context) { return $visitor->visitString($uuid->toString(), $type, $context); }
/** * @return null|string */ public function getUuidString() { return $this->uuid ? $this->uuid->toString() : null; }
/** * @param EntityManager $em * @param Uuid $uuid * * @return bool */ protected function findMatchingRow(EntityManager $em, Uuid $uuid) { return $em->find(self::$metadata->getName(), ['uuid' => $uuid->toString()]); }
public function getId() : string { return $this->id->toString(); }
/** * @return string */ public function toString() { return $this->uuid->toString(); }