Skip to content

[Uid] Document the namespace string values #15272

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
Apr 22, 2021
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
15 changes: 8 additions & 7 deletions components/uid.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ to create each type of UUID::
$uuid = Uuid::v3($namespace, $name); // $uuid is an instance of Symfony\Component\Uid\UuidV3
$uuid = Uuid::v5($namespace, $name); // $uuid is an instance of Symfony\Component\Uid\UuidV5

// the namespaces defined by RFC 4122 are available as constants
// (see https://tools.ietf.org/html/rfc4122#appendix-C)
$uuid = Uuid::v3(Uuid::NAMESPACE_DNS, $name);
$uuid = Uuid::v3(Uuid::NAMESPACE_URL, $name);
$uuid = Uuid::v3(Uuid::NAMESPACE_OID, $name);
$uuid = Uuid::v3(Uuid::NAMESPACE_X500, $name);
// the namespaces defined by RFC 4122 (see https://tools.ietf.org/html/rfc4122#appendix-C)
// are available as PHP constants and as string values
$uuid = Uuid::v3(Uuid::NAMESPACE_DNS, $name); // same as: Uuid::v3('dns', $name);
$uuid = Uuid::v3(Uuid::NAMESPACE_URL, $name); // same as: Uuid::v3('url', $name);
$uuid = Uuid::v3(Uuid::NAMESPACE_OID, $name); // same as: Uuid::v3('oid', $name);
$uuid = Uuid::v3(Uuid::NAMESPACE_X500, $name); // same as: Uuid::v3('x500', $name);

// UUID type 6 is not part of the UUID standard. It's lexicographically sortable
// (like ULIDs) and contains a 60-bit timestamp and 63 extra unique bits.
Expand All @@ -69,7 +69,8 @@ to create each type of UUID::

.. versionadded:: 5.3

The ``Uuid::NAMESPACE_*`` constants were introduced in Symfony 5.3.
The ``Uuid::NAMESPACE_*`` constants and the namespace string values (``'dns'``,
``'url'``, etc.) were introduced in Symfony 5.3.

If your UUID value is already generated in another format, use any of the
following methods to create a ``Uuid`` object from it::
Expand Down