Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Uid] Added toHexString method to AbstractUid class #45945

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
Jul 20, 2022

Conversation

aurimasniekis
Copy link
Contributor

Q A
Branch? 6.1
Bug fix? no
New feature? yes
Deprecations? no
Fix #42966
License MIT

Added a small method to Uid component AbstractUid class called toHex which would output binary value of identifier as prefixed hex string for e.g. 0x0000000. This is really useful when using with Doctrine for Id generation as the storage of Uid is a binary format in the database, and in most cases, it is usually used with hex format to query it.

This PR is from #45939 as I needed to change the source branch to 6.1

@aurimasniekis
Copy link
Contributor Author

aurimasniekis commented Apr 5, 2022

Can't fix the Coding standard from fabbot.io because assertSame has to have those spaces (was really annoying to fix with .editorconfig)

If the branch is 6.1 will this be integrated into 6.0/5.4 versions or only 6.1?

@OskarStark
Copy link
Contributor

If the branch is 6.1 will this be integrated into 6.0/5.4 versions or only 6.1?

Only in 6.1

@OskarStark OskarStark requested a review from fancyweb April 5, 2022 21:13
@fancyweb
Copy link
Contributor

fancyweb commented Apr 6, 2022

Should we just add it in the inspect commands? IMHO, adding it to AbstractUid makes it a new Uid component supported format, so we would have to support it everywhere (from methods and format in UidNormalizer at least).

We could also add it to the SymfonyCaster class from the VarDumper component.

@aurimasniekis
Copy link
Contributor Author

I can add fromHex method too, as it depends on binary methods so I don't see why it can cause any issues. My goal for this PR was to add a method for getting hex string values as it's heavily used in our several applications, and having to make wrappers/methods to get value that can be used directly in the database without using converter functions is really nice, because the normal base32 version is only used basically for the input data into the application and nowhere outside.

I can implement those methods in this PR just provide of additional places it ned to be supported.

@fancyweb
Copy link
Contributor

fancyweb commented Apr 8, 2022

I recommend waiting for @nicolas-grekas opinion before putting in any extra work.

@nicolas-grekas
Copy link
Member

I don't see the need for fromHex, so I'd prefer not adding it. I agree with @fancyweb about the commands.

@aurimasniekis
Copy link
Contributor Author

Any progress on this?

@fabpot fabpot modified the milestones: 6.1, 6.2 May 20, 2022
@fabpot
Copy link
Member

fabpot commented Jul 20, 2022

Thank you @aurimasniekis.

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.

6 participants