Skip to content

[Uid] Expand the explanation about the different UUID variants #19710

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 3, 2024

Conversation

javiereguiluz
Copy link
Member

I'm always in favor of making docs as concise as possible, but I think that in this case we should do the opposite and expand the existing docs a bit.

First, the explanation of UUIDs is a very big block of code: https://symfony.com/doc/current/components/uid.html#generating-uuids It looks intimidating and not that clear.

Second, we don't mention many details about some UUIDs, so I propose to add more details.

Lastly, the current examples don't work for UUIDv3 and v5. The given namespace argument must be a Uuid object, not a string:

// this does NOT work
$uuid = Uuid::v3(Uuid::NAMESPACE_DNS, $name);

// this WORKS:
$namespace = Uuid::fromString(Uuid::NAMESPACE_OID);
$uuid = Uuid::v3($namespace, 'Hello World');

@javiereguiluz javiereguiluz merged commit ed6b870 into symfony:6.4 Apr 3, 2024
@javiereguiluz javiereguiluz deleted the uuid branch April 3, 2024 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants