Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[FWB][Serializer][Form][Validator] Uid integration #36317

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 33 commits into from

Conversation

guillbdx
Copy link

@guillbdx guillbdx commented Apr 2, 2020

Q A
Branch? master
Bug fix? no
New feature? yes
Deprecations? I think he UUID Validator should get deprecated? Please confirm this point.
Tickets Fix #36102
License MIT

Integration of the Uid Component to Symfony stack:

  • a normalizer/denormalizer for Serializer
  • a constraint validator
  • a DataTransformer and FormType
  • a command line to generate new UIDs

Copy link
Contributor

@maxhelias maxhelias left a comment

Choose a reason for hiding this comment

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

I love the idea very much but I don't agree with the form integration. Normally, you should never have uid fields in a form. Otherwise a new doctrine type in the bridge would be really nice.

$io = new SymfonyStyle($input, $output);

if (!class_exists(AbstractUid::class)) {
throw new \RuntimeException('Unable to execute this command as the Symfony Uid Component is not installed.');
Copy link
Contributor

Choose a reason for hiding this comment

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

You should remove the service in the FrameworkExtension file when the AbstractUid doesn't exist instead of throwing an exception

@@ -70,6 +70,12 @@
<tag name="serializer.normalizer" priority="-890" />
</service>

<service id="serializer.normalizer.uid" class="Symfony\Component\Serializer\Normalizer\UidNormalizer">
<argument>%kernel.debug%</argument>
Copy link
Contributor

Choose a reason for hiding this comment

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

You should remove this argument

Copy link
Author

Choose a reason for hiding this comment

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

Done.

@maxhelias
Copy link
Contributor

BTW, let me know when you have finished, i could test it

@ro0NL
Copy link
Contributor

ro0NL commented Apr 4, 2020

i tend to prefer concrete UUID, ULID, ... validators. It allows for more fine grained control per type. E.g. ensure a specific UUID version maybe.

I'd also think we should either support sf/uid as well as ramsey/uuid, but not an issue for me.

Im not sure about the form type either, nor the console command.

@dunglas
Copy link
Member

dunglas commented Apr 5, 2020

👍 for the serializer part
for the validator part, I agree with @ro0NL, it must be possible to specify the type of UUID that is allowed

I've not reviewed other parts.

@guillbdx
Copy link
Author

guillbdx commented Apr 6, 2020

Hi @ro0NL @dunglas , that is the case, the types option allow you to choose between ULID, UUID_V1, UUID_V3, etc.

Another possibility would be to have 2 options :

  • type: either ULID or UUID
  • versions: UUID version (this option would have no effect if type is ULID)

Or another possibility: 2 different constraints, 1 ULID constraint and 1 UUID constraint, with a versions option on the UUID one.

What do you think is better?

@xabbuh
Copy link
Member

xabbuh commented Apr 7, 2020

Maybe you could split the PR into smaller ones so that people can focus on the components they know best?

@ro0NL
Copy link
Contributor

ro0NL commented Apr 7, 2020

Or another possibility: 2 different constraints, [...]
What do you think is better?

i strongly prefer constraints per case.

@guillbdx
Copy link
Author

guillbdx commented Apr 9, 2020

I've split this PR in 3 smaller PR, one per component:

I'm closing this PR.

@guillbdx guillbdx closed this Apr 9, 2020
@nicolas-grekas nicolas-grekas modified the milestones: next, 5.1 May 4, 2020
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.

[Uid] integration with the other components
7 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.