/** * {@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)); } }
public function it_should_generate_ordered_uuid(UuidFactoryInterface $factory) { $factory->uuid1()->willReturn('a8098c1a-f86e-11da-bd1a-00112444be1e'); $this->generateOrderedUuid1()->shouldReturn('11daf86ea8098c1abd1a00112444be1e'); }
/** * @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); }
/** * @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; }