示例#1
0
 /**
  * {@inheritdoc}
  */
 public function apply(Request $request, ParamConverter $configuration)
 {
     $name = $configuration->getName();
     $uuid = $request->attributes->get($name, null);
     try {
         $request->attributes->set($name, $this->factory->fromString($uuid));
         return true;
     } catch (InvalidArgumentException $exception) {
         throw new NotFoundHttpException(sprintf('The identifier "%s" is not valid.', $uuid));
     }
 }
示例#2
0
 public function it_should_generate_ordered_uuid(UuidFactoryInterface $factory)
 {
     $factory->uuid1()->willReturn('a8098c1a-f86e-11da-bd1a-00112444be1e');
     $this->generateOrderedUuid1()->shouldReturn('11daf86ea8098c1abd1a00112444be1e');
 }
示例#3
0
 /**
  * @param Collection $collection
  * @param $document
  */
 public function insert($collection, $document)
 {
     $document->_id = $this->uuid->uuid4()->toString();
     $args = ['TableName' => $collection, 'Item' => $this->marshaler->marshalItem($document)];
     $this->getConnection()->putItem($args);
 }
示例#4
0
文件: Uuid.php 项目: DeSmart/support
 /**
  * @return string
  */
 public function generateOrderedUuid1()
 {
     $uuid = str_replace('-', '', (string) $this->factory->uuid1());
     $uuid = substr($uuid, 12, 4) . substr($uuid, 8, 4) . substr($uuid, 0, 8) . substr($uuid, 16);
     return $uuid;
 }