예제 #1
0
 /**
  * {@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.');
 }
예제 #2
0
 /**
  * @return string
  */
 public function toString()
 {
     return static::toOrderedUuid($this->uuid->toString());
 }
예제 #3
0
 /**
  * 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);
 }
예제 #4
0
 /**
  * Serializes the uuid.
  * @param VisitorInterface $visitor
  * @param Uuid $uuid
  * @return string
  */
 public function serialize(VisitorInterface $visitor, Uuid $uuid)
 {
     return $uuid->toString();
 }
예제 #5
0
 /**
  * {@inheritdoc}
  */
 public function getBinding(Uuid $uuid)
 {
     if (!isset($this->bindings[$uuid->toString()])) {
         throw NoSuchBindingException::forUuid($uuid);
     }
     return $this->bindings[$uuid->toString()];
 }
예제 #6
0
 protected function preSerialize(array &$data)
 {
     $data[] = $this->typeName;
     $data[] = $this->userParameterValues;
     $data[] = $this->uuid->toString();
 }
예제 #7
0
 /**
  * @Route("/optionalAutomatic/{uuid}")
  */
 public function optionalAutomaticAction(Uuid $uuid = null)
 {
     return new Response($uuid ? $uuid->toString() : null);
 }
예제 #8
0
 /**
  * @return string
  */
 public function __toString()
 {
     return $this->value->toString();
 }
예제 #9
0
 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()]);
 }
예제 #12
0
 public function getId() : string
 {
     return $this->id->toString();
 }
예제 #13
0
 /**
  * @return string
  */
 public function toString()
 {
     return $this->uuid->toString();
 }