コード例 #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
ファイル: UuidHandler.php プロジェクト: palya-framework/palya
 /**
  * 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);
 }
コード例 #10
0
 /**
  * @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();
 }