Skip to content

Commit 6b319a2

Browse files
[Uid] Add UuidV1::toV6(), UuidV1::toV7() and UuidV6::toV7()
1 parent 0b70c22 commit 6b319a2

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

components/uid.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,26 @@ Use these methods to transform the UUID object into different bases::
180180
$uuid->toRfc4122(); // string(36) "d9e7a184-5d5b-11ea-a62a-3499710062d0"
181181
$uuid->toHex(); // string(34) "0xd9e7a1845d5b11eaa62a3499710062d0"
182182

183+
Some UUID versions support being converted from one version to another::
184+
185+
// convert V1 to V6 or V7
186+
$uuid = Uuid::v1();
187+
188+
$uuid->toV6(); // returns a Symfony\Component\Uid\UuidV6 instance
189+
$uuid->toV7(); // returns a Symfony\Component\Uid\UuidV7 instance
190+
191+
// convert V6 to V7
192+
$uuid = Uuid::v6();
193+
194+
$uuid->toV7(); // returns a Symfony\Component\Uid\UuidV7 instance
195+
196+
.. versionadded:: 7.1
197+
198+
The :method:`Symfony\\Component\\Uid\\UuidV1::toV6`,
199+
:method:`Symfony\\Component\\Uid\\UuidV1::toV7` and
200+
:method:`Symfony\\Component\\Uid\\UuidV6::toV7`
201+
methods were introduced in Symfony 7.1.
202+
183203
Working with UUIDs
184204
~~~~~~~~~~~~~~~~~~
185205

0 commit comments

Comments
 (0)