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

Skip to content

[Uid] Added toHexString method to AbstractUid class #45939

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

Closed
wants to merge 1 commit into from

Conversation

aurimasniekis
Copy link
Contributor

@aurimasniekis aurimasniekis commented Apr 4, 2022

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 toHexString 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.

@carsonbot carsonbot added this to the 5.4 milestone Apr 4, 2022
@nicolas-grekas nicolas-grekas modified the milestones: 5.4, 6.1 Apr 4, 2022
Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR.

This relates to #42966. In order to completely implement the issue, we should also patch the uuid:inspect and uuid:inspect commands to display that number.

This is a new feature so it should target branch 6.1.

/**
* Returns the identifier as a prefixed hexadecimal case insensitive string.
*/
public function toHexString(): string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

toHex() to be enough and better to me

@aurimasniekis
Copy link
Contributor Author

I had to open new PR because source branch has changed #45945

fabpot added a commit that referenced this pull request Jul 20, 2022
…urimasniekis)

This PR was merged into the 6.2 branch.

Discussion
----------

[Uid] Added toHexString method to AbstractUid class

| 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

Commits
-------

dad28d6 Added toHexString method to AbstractUid class
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.

3 participants