Skip to content

[Uid] Add UuidV1::toV6(), UuidV1::toV7() and UuidV6::toV7() #19362

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions components/uid.rst
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,26 @@ Use these methods to transform the UUID object into different bases::
$uuid->toRfc4122(); // string(36) "d9e7a184-5d5b-11ea-a62a-3499710062d0"
$uuid->toHex(); // string(34) "0xd9e7a1845d5b11eaa62a3499710062d0"

Some UUID versions support being converted from one version to another::

// convert V1 to V6 or V7
$uuid = Uuid::v1();

$uuid->toV6(); // returns a Symfony\Component\Uid\UuidV6 instance
$uuid->toV7(); // returns a Symfony\Component\Uid\UuidV7 instance

// convert V6 to V7
$uuid = Uuid::v6();

$uuid->toV7(); // returns a Symfony\Component\Uid\UuidV7 instance

.. versionadded:: 7.1

The :method:`Symfony\\Component\\Uid\\UuidV1::toV6`,
:method:`Symfony\\Component\\Uid\\UuidV1::toV7` and
:method:`Symfony\\Component\\Uid\\UuidV6::toV7`
methods were introduced in Symfony 7.1.

Working with UUIDs
~~~~~~~~~~~~~~~~~~

Expand Down